Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to plot dates expressed in the form of number?

1 回表示 (過去 30 日間)
gsourop
gsourop 2019 年 6 月 5 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi everyone,
I want to plot dates that are expressed in the following format:
% x-axis
Time = [730211, 730241, 730302, 730333]
% y -axis
Values = [0.602300789014034, 0.603937673632081, 0.606134076857801, 0.609570252971655]
plot(Time,Values) % ERROR
I am not sure how to transform the existing time format into proper time format that can be used in a plot.
Thank you.
  1 件のコメント
Steven Lord
Steven Lord 2019 年 6 月 5 日
When I run those three lines of code I do not receive an error. Can you show the full and exact text of the error message you received (all the text displayed in red?)

回答 (1 件)

Star Strider
Star Strider 2019 年 6 月 5 日
Try this:
plot(Time,Values)
datetick('x','yyyy/mm/dd')
Experiment to get the result you want.
You can also transform them to a datetime (link) object, which is likely easier.

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by