- (data.time, data.A1) and
- (data.A2, data.A3)
How can I plot a table with data and time ?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Coginator
el 30 de Mzo. de 2021
Respondida: Cris LaPierre
el 30 de Mzo. de 2021
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 comentarios
Respuesta aceptada
Cris LaPierre
el 30 de Mzo. de 2021
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Tables en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
