![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/690483/image.png)
WHY CAN'T I PLOT THIS WITH "DATETIME"?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I can't plot because of the error with "data time".
Does anyone know how I can solve this problem.
Thank you.
0 Commenti
Risposta accettata
Star Strider
il 20 Lug 2021
The first column is not a valid datetime array. It first needs to be converted to one.
Try this —
LD = load('LARSEN_MMEQ1.mat');
LARSENMMEQ1 = LD.LARSENMMEQ1;
LARSENMMEQ1.Var1 = datetime(LARSENMMEQ1.Var1, 'InputFormat','MM/dd/yyyy');
x = LARSENMMEQ1.Var1;
y = LARSENMMEQ1.Var2;
figure
plot(x, y)
grid
producing —
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/690483/image.png)
.
8 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!