Error time series plot: cannot perform numeric operation which have non numerical data
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
CARLOTTA DENTICO
el 24 de Jun. de 2021
Comentada: Walter Roberson
el 25 de Jun. de 2021
Hello everybody!
I had a table object that I transformed to timeseries. When it comes to plot it, I get an error... How can I solve this issue?
Thank you very much!
prova4 = timeseries(mmean1416_pt); %1x1 table timeseries, in which time is categorical in the form Jan-2014
plot(prova4)
Error using timeseries/plot (line 47)
Cannot perform numeric operations on timeseries which have non-numeric data
0 comentarios
Respuesta aceptada
Walter Roberson
el 24 de Jun. de 2021
When you use timeseries() on a table object, then timeseries() does not look inside the table at the variables. It creates times 0:(rows-1) (seconds) where rows is the number of rows in the table. And the data associated with the time is the entire table row.
But table rows are not numeric, they are table() objects. And table() objects cannot be plotted.
If you have a table object that has a time field, you should consider creating a timetable(). There is no plot() for timetable objects, but you can access the Time property and whatever variable is appropriate.
Caution: If your times are categorical, then you have to be careful in how you construct the categorical in order to impose a sorting order and associated position values. Probably easier to datetime() with a 'convertfrom' to convert the categorical text into datetimes.
7 comentarios
Walter Roberson
el 25 de Jun. de 2021
What is the first entry in ts1416theta.Time ? Your comments earlier indicated it encodes 01-Jan-2014 00:30:00 but what is its class() and how does it show up when you display it?
Más respuestas (0)
Ver también
Categorías
Más información sobre Time Series 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!