How do i plot temperature vs date and time?
9 ビュー (過去 30 日間)
古いコメントを表示
Hey
I´m trying to plot data from a matrix looking like this: 3 columns with several measurements each day at different times.
Day Time Temp 1 09:00 16 2 09:00 16.2
and so on.
I want to create a plot with temp on y axis and day AND time on the x axis. So far i managed to plot the temp vs time, but this generates a graph with many different lines but not separated by day som they all end upon top of each other.
I need a command that makes matlab differentiate between the days, not only the time.
Ive been looking at commands like xtick, datetick etc but i dont get how to create what im looking for using these commands.
Thanks in advance for tips and hints.
0 件のコメント
回答 (2 件)
Andrei Bobrov
2012 年 11 月 13 日
編集済み: Andrei Bobrov
2012 年 11 月 13 日
file yourdata.txt have values:
Day Time Temp
1 09:00 16
2 09:00 16.2
...
solution
f = fopen('yourdata.txt');
c = textscan(f,'%f %s %f','HeaderLines',1);
fclose(f);
d = [c{1}-1 + rem(datenum(c{2},'HH:MM'),1), c{3}];
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!