how to plot the time series data with dates showing in x axis

13 ビュー (過去 30 日間)
Farshid Daryabor
Farshid Daryabor 2020 年 3 月 18 日
コメント済み: Cris LaPierre 2020 年 3 月 19 日
I can plot time series but I am not able to show exact dates on x axis. I really appreciate anybody can help me. Thanks
figure
Ts = timeseries(Ta);
plot(Ts,'r')
grid on
grid minor
xlabel('Time','fontsize',14)
ylabel('Temperature (\circC)','fontsize',14)
Problem, cannot manage date lable, you can find attached file may show me how it's work.

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 3 月 18 日
編集済み: Cris LaPierre 2020 年 3 月 18 日
Convert your dates to the datetime data type. Then, when you plot using the datetime, the date will appear on the axis. You can set the display format of a datetime to show the date however you'd like.
load example.mat
Time = datetime(time,'ConvertFrom',"excel")
plot(Time,Ta)
You may need to adjust the ConvertFrom datatype. I didn't know, so I just selected a common one.
  14 件のコメント
Farshid Daryabor
Farshid Daryabor 2020 年 3 月 19 日
(thanks)^10000000
Cris LaPierre
Cris LaPierre 2020 年 3 月 19 日
Very good! Glad you got it working.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTime Series Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by