plotting live data from a sensor
古いコメントを表示
Hello,
I'm trying to plot a line graph of the live data from my sensor. However, when I run my code is does not display the line.
Thanks in advance
code:
clear all;
S = serialport('COM5',115200);
temp =[];
accx=[];
accy=[];
accz=[];
i = 0;
while true
if S.NumBytesAvailable > 0
data = readline(S);
temp = [str2double(split(data,','))];
accx = [accx;temp(1)];
accy = [accy;temp(2)];
accz = [accz;temp(3)];
plot(i,temp(1))
i=i+1;
end
end

採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!