필터 지우기
필터 지우기

fscanf of live stream question

조회 수: 1 (최근 30일)
fima v
fima v 2020년 10월 31일
댓글: dpb 2020년 10월 31일
Hello I have written the following code for counting how much '\n' chars we have so far.
i assume fscanf holds the char recieved in the live streaming but instead it shows val as an array of growing number.
and throws me the following error Matrix "dimensions must agree."
how can i check what char was recieved rigt now?
Thanks.
sObject=serial('COM4','BaudRate',115200,'TimeOut',10,'Terminator','LF')
fopen(sObject)
k=0;
while 1==1
val=fscanf(sObject)
if val=='\n'
k=k+1
end
end
  댓글 수: 1
dpb
dpb 2020년 10월 31일
If you have R2019b, use the serialport object instead of serial

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by