Plot binary data from serial port

1 次查看(过去 30 天)
Adi Mico
Adi Mico 2011-7-8
I want to plot the bit data signal from the serial port. I use the command fread as Matlab say that fread is the funtion to read binary data. But when I use fread, I got numbers like 10,41,83,etc instead of 0 and 1. I want to view the signal as 0 and 1 so the plot is like squarewave. What am I supposed to do?
Here are my codes:
x=0:0.01:10;
y=fread(s);
cla;drawnow;
h=plot(handles.axes1,x(1),y(1));grid on; hold on; legend data;
for idx = 1 : length(x);
set(h,'xdata',x(1:idx),'ydata',y(1:idx));drawnow; end;
% s is the serial.
  1 个评论
Lorenzo Luengo
Lorenzo Luengo 2011-7-8
you mean something like view the serial stream?? maybe you can try this using dec2bin function.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by