- (data.time, data.A1) and
- (data.A2, data.A3)
How can I plot a table with data and time ?
6 ビュー (過去 30 日間)
古いコメントを表示
Hi
I have a Problem. I have a 94x4 table with one time array and thre arrays with data.
the time array has the formation
00:14:49
00:29:49
00:44:49
....
for example
the data are
0.104
0.106
0.111
...
Im using this script:
data = readtable("xxx.csv");
plot(data.time,data.A1,data.A2,data.A3);
hold on
grid on
plot(data.time,data.A1,data.A2,data.A3);
xlabel("Zeit"),ylabel("Trübung")
legend('A1', 'A2','A3','location','best')
How can i convert the data form time in a formation that works?
Sorry for my bad englisch... hope someone can help me
0 件のコメント
採用された回答
Cris LaPierre
2021 年 3 月 30 日
What data type are you using to store your times? If you make it a duration, it will work.
time = ["00:14:49"; "00:29:49"; "00:44:49"];
A1 = rand(3,1);
A2 = rand(3,1);
A3 = rand(3,1);
data = table(time,A1,A2,A3)
% Converte time to duration
data.time = duration(data.time,'InputFormat','hh:mm:ss')
Note that your plot syntax will create 2 lines
You also repeat the plot command twice. You only need in once.
I assume you want 3 lines, all with time as the x value. In that case, try the following (assuming time is now a duration).
plot(data.time,data{:,["A1","A2","A3"]})
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Tables についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
