Plot datetime data from a cell array?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have data set shown in fig. But I do not how to access to the data.
I try to use: plot(index{2:end, 1}, cell2mat(index(2:end, 2)), 'b'), but it does not work.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/561948/image.png)
0 commentaires
Réponse acceptée
Stephen23
le 25 Mar 2021
Modifié(e) : Stephen23
le 25 Mar 2021
A cell array containing lots of scalar arrays indicates that your data is arranged sub-optimally. You would be much better off using a table, or perhaps two separate homogenous vectors (i.e. a datetime array and a numeric array).
Converting to two homogenous arrays is probably the easiest way to plot the existing (badly designed) data:
dt = [index{2:end,1}];
ix = [index{2:end,2}];
plot(dt,ix)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Type Conversion dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!