Borrar filtros
Borrar filtros

Writing matrix in text file to serial port

5 visualizaciones (últimos 30 días)
Anjani Chaudhary
Anjani Chaudhary el 14 de Sept. de 2019
Respondida: Walter Roberson el 14 de Sept. de 2019
I have matlab 2016b version. I am trying to find my com port using seriallist or getAvailableComPort function. But its saying function /variable not defined. M not bale to use many other functions like readmatrix, serialport etc What could be the reason? Help appreciated.
Thanks.
A

Respuestas (1)

Walter Roberson
Walter Roberson el 14 de Sept. de 2019
The reason is that those routines do not exist until R2018b and r2019a.
Furthermore, readmatrix and writematrix are for dealing with file io not for serial ports.
You should be using instrfind to look for serial ports. Use serial() to construct a serial port object. fopen() it after configuration. fprintf() to send numeric values as text.
Be careful: fprintf outputs down the columns. If you ask to fprintf
1 2 3
4 5 6
Then it will output in the order 1 4 2 5 3 6. The trick is to transpose() 2d matrices

Categorías

Más información sobre Data Import and Export en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by