필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Kalen Timbs
Kalen Timbs 2016년 5월 24일
댓글: islam dib 2020년 12월 9일
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?

답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 24일
fid = serial('COMx', 'baudrate', 9600);
You should also consider setting the Terminiator property.
  댓글 수: 1
islam dib
islam dib 2020년 12월 9일
hello,
what u mean by "You should also consider setting the Terminiator property." ?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Standard File Formats에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by