![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271471/image.jpeg)
Plotting table data with dates
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
jinang patel
el 13 de Feb. de 2020
Respondida: Lei Hou
el 13 de Feb. de 2020
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271440/image.png)
hello,
Im trying the following, however the plot doesnt display dates correctly
A=[10/20/2019 5; 11/12/2019 6]
table=array2table(A,'variablenames',{'date','point'})
plot(table.date,table.point)
datetick();
0 comentarios
Respuesta aceptada
Lei Hou
el 13 de Feb. de 2020
Hi Jinang,
In your code, the first column of "A" is not a datetime. It is just numeric value calculated by using division operator (/). You should construct two variables: one for datetime, and the other for numeric data. Here is one solution to your problem.
date = [datetime(2019,10,20);datetime(2019,11,12)];
point = [5;6];
table = table(date, point);
plot(table.date,table.point)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/271471/image.jpeg)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time 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!