Error time series plot: cannot perform numeric operation which have non numerical data
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2021-6-24
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 个评论
Walter Roberson
2021-6-25
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?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!