(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."
Afficher commentaires plus anciens
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 commentaire
Jane Fowler
le 10 Juil 2020
Réponse acceptée
Plus de réponses (1)
Jane Fowler
le 10 Juil 2020
1 vote
Catégories
En savoir plus sur Calendar dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!