creating array of strings from recieved data

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

Antworten (1)

Walter Roberson
Walter Roberson am 7 Dez. 2020

0 Stimmen

data(i) = string(fscanf(sObject)) ;
fscanf does not return strings: it returns character vectors.

Kategorien

Mehr zu Data Types finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 7 Dez. 2020

Beantwortet:

am 7 Dez. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by