- (data.time, data.A1) and
- (data.A2, data.A3)
How can I plot a table with data and time ?
조회 수: 4 (최근 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!
