Effacer les filtres
Effacer les filtres

How can I open and read data from a serial port?

1 vue (au cours des 30 derniers jours)
Kalen Timbs
Kalen Timbs le 24 Mai 2016
Commenté : islam dib le 9 Déc 2020
To open/read pre-recorded data I have previously used:
fileID = fopen('filename.txt', 'rt'); line = fgetl(fileID);
to read the text file line by line. However, I need to be able to read data from an instrument connected to a serial port.
i have used
fid = serial(COMx,baudrate,9600);
fopen(fid);
Will this work for a live instrument?

Réponses (1)

Walter Roberson
Walter Roberson le 24 Mai 2016
fid = serial('COMx', 'baudrate', 9600);
You should also consider setting the Terminiator property.
  1 commentaire
islam dib
islam dib le 9 Déc 2020
hello,
what u mean by "You should also consider setting the Terminiator property." ?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by