I would like to know whether it is possible to plot a real
time graph from serial port input.
I have written the code, but it seems the data is not
plotting real time. I understand that the data is stored in
inputbuffer before it is being taken out by matlab to read.
Is it possible for matlab to constantly check the
inputbuffer instead of waiting for timeout to occur then
read the data.?
The short answer is yes. To get better help post the
portion of your code where you are having trouble. You
should be able poll the serial port object for bytes
available and read them as they become available and update
your plot using drawnow as the values are read.
a pause(0.01) just after plot seemed to do the trick, but
obviously, it reduces the speed of your program....
> inputbuffer before it is being taken out by matlab to read.
> Is it possible for matlab to constantly check the
> inputbuffer instead of waiting for timeout to occur then
> read the data.?
>
>
...not sure about this bit
Regards,
Sach
Hi,
A couple of things you might want to try:
1. BytesAvailableFcn is a callback that you set to run at
every BytesAvailableFcnCount number of bytes in your input
buffer
2. Instead of plotting every time, try updating only the
axis property of the figure handle
Hope this helps
-Ankit
you could see my post that does the serial port plot with an arduino uc.
Thanks,
--sreeram