필터 지우기
필터 지우기

creating array of strings from recieved data

조회 수: 2 (최근 30일)
fima v
fima v 2020년 12월 7일
답변: Walter Roberson 2020년 12월 7일
Hello,my serial Comm sends over and over abcd/n which in matlab abcd
i wanted to create and array of abcd strings as shown bellow using the code bellow.but it gives me dimentions error.
Where did i go wrong?
Thanks.
abcd
abcd
abcd
.
.
sObject=serial('COM4','BaudRate',115200,'TimeOut',10,'Terminator','LF');
fopen(sObject);
i=1;
while(i<100)
data(i)=fscanf(sObject);
i=i+1;
end

답변 (1개)

Walter Roberson
Walter Roberson 2020년 12월 7일
data(i) = string(fscanf(sObject)) ;
fscanf does not return strings: it returns character vectors.

카테고리

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