plot with string value in x axis

I have a data
date temperate
----
'2020-01' 10
'2020-02' 10
'2020-03' 20
I tried
plot(date, temperature)
and got "invalid data argument"
Please advise.

4 commentaires

Stephen23
Stephen23 le 3 Juil 2020
Convert the string array to datetime, and then it will work like you expect.
alpedhuez
alpedhuez le 3 Juil 2020
Modifié(e) : alpedhuez le 3 Juil 2020
datetime(yyyy_mm,'InputFormat','yyyy-mm')
does not work
madhan ravi
madhan ravi le 3 Juil 2020
Modifié(e) : madhan ravi le 3 Juil 2020
alpedhuez
alpedhuez le 3 Juil 2020
Modifié(e) : alpedhuez le 3 Juil 2020
Solution: the problem is that in Matlab 'mm' is minuets that one needed to use 'MM' for months.

Connectez-vous pour commenter.

Réponses (0)

Catégories

Tags

Question posée :

le 3 Juil 2020

Modifié(e) :

le 3 Juil 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by