How do I plot a datetime vs data within a cell array?
Mostrar comentarios más antiguos
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 comentarios
Rik
el 3 de Jul. de 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
el 3 de Jul. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!