(2016a) How to plot datetime versus numbers? Error: "Data inputs must match the axis configuration. A numeric axis must have numeric data inputs or data inputs which can be converted to double."
显示 更早的评论
I'm using Matlab 2016a and I am relatively new to Matlab. I have imported data from a large external file. The first column is datetime in the following format:
2015-07-01 01:00:00
The other columns are all numbers. E.g.,
1100.0
I want to plot the datetime data as X and numbers as Y. I have tried the following, where DT_1 is the column of imported datetime data and n_raw is a column of numbers:
DT_1_test = datetime(DT_1, 'InputFormat', 'yyyy-MM-dd HH:mm:ss')
t = datetime(DT_1_test);
DateNumber = datenum(t)
plot(DateNumber, n_raw);
There are two problems.
- My screen output for datetime is in the wrong format. Example: 10-Jul-2019 23:00:00
- Also, I get this error: "Data inputs must match the axis configuration. A numeric axis must have numeric data inputs or data inputs which can be converted to double."
I would be very grateful for any help. I have not been able to get past it all day. Thank you.
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!