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 个评论

Convert the string array to datetime, and then it will work like you expect.
datetime(yyyy_mm,'InputFormat','yyyy-mm')
does not work
Solution: the problem is that in Matlab 'mm' is minuets that one needed to use 'MM' for months.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Dates and Time 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by