How do I plot a datetime vs data within a cell array?
Ältere Kommentare anzeigen
Hello! Say I have a nx2 cell array named CELL with the following data types per column:
column 1: datetime
column 2: double
Whenever I try to plot using plot(CELL{:,1},CELL{:,2}), the following error occur:
"Data inputs must match the axis configuration. A numeric axis must have numeric data inputs or data inputs which can be converted to double. "
NOTE: I also tried cell2mat(CELL{:,1}) to try if I can convert the datetime column into an array but the following error occurs:
"CELL2MAT does not support cell arrays containing cell arrays or objects."
May I ask how I can plot the datetime cell column against the double cell column? Thank you very much in advance.
2 Kommentare
Rik
am 3 Jul. 2019
You must either convert your data to single arrays, or use a loop. Note that {:} creates a comma separated list, so you should use normal parentheses in your call to cell2mat.
Jonathan Macuroy
am 3 Jul. 2019
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Data Type Conversion finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!