Serial Communication with Matlab

Thread Starter

Dammi

Joined Feb 15, 2011
16
Hi guys

I was wondering, how do I make Matlab stop reading from a serialport ?

I have this:

s = serial('COM2');
set(s,'BaudRate',9600);
set(s,'DataBits',8);
set(s,'StopBits',1);
fopen(s);
av = fscanf(s);

And I get the data I want, I just want Matlab to stop reading from the port when the data has been sent, cause I'll be sending the data again after that, so how would I do that?

In other words, how do I tell Matlab to stop/start reading when a certain char has been sent? I see when I enable the serial communication taht "Terminator is 'LF'" .. so should I send 'LF' from the MC to let matlab stop ?

Help plz :)
 

Thread Starter

Dammi

Joined Feb 15, 2011
16
I used fread instead, wasn't able to use the LF character function, but it's okay, we worked around it :)
 
Top