Plot data with time axis

4 ビュー (過去 30 日間)
Pablo Varela
Pablo Varela 2012 年 11 月 18 日
Hello.
I have a function that takes data (one each minute) from serial port an plot them in a figure. At the moment, axis are number of samples, but I would like to have time (in format hh:mm). How could I do it?
while(1)
data =fscanf(s);
numValue=str2num(data);
v=numValue*5/1024;
tempK=v*100;
tempC=tempK-273;
if(numWindow<sizeWindow+1)
window(1,numWindow)=tempC;
numWindow=numWindow+1;
else
for i=1:sizeWindow
tempFiltered=tempFiltered+window(1,i);
end
tempFiltered=tempFiltered/sizeWindow;
x =[x tempFiltered];
plot(x);
drawnow;
disp(tempFiltered);
tempFiltered=0;
numWindow=1;
end
end

採用された回答

Ankit Desai
Ankit Desai 2012 年 11 月 19 日
This file exchange post might help. It shows how to use date/time as your X-axis.
You can ignore the stuff that does not relate.
Hope this helps -Ankit
  1 件のコメント
Pablo Varela
Pablo Varela 2012 年 11 月 19 日
Thanks a lot, is exactly what I wanted.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by