Arduino erros using Matlab. (Use Matlab like Monitor Serial)

1 view (last 30 days)
Hi, I trying to control one Arduino system and read their output data, just like the monitor serial from the Arduino IDE. I read a little about it, but I only find how to set some outputs signals and/or read some digital outputs. I trying something but it always comes to this message and I can only read the first message that would come in the serial monitor. 'Warning: Unsuccessful read: A timeout occurred before the Terminator was reached..'
s = serial('COM11')
set(s,'BaudRate', 115200)
fopen(s)
out = fscanf(s)
z=1;
while (z==1)
dat = fscanf(s);
fwrite(s,1);
fscanf(s);
end
It's one way that the Matlab works like the serial monitor, I mean, that I can read e write information instantly? I like to use Matlab because sometimes I would like to use some loops and it would be impossible to do automatic in serial monitor from Arduino IDE.
Thanks, everybody.
  4 Comments
Walter Roberson
Walter Roberson on 24 Nov 2017
Please experiment with changing fwrite(s,1) to fprintf(s,'1\n')

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!