Spacing Xticks in plotting a function

4 ビュー (過去 30 日間)
Riccardo Tronconi
Riccardo Tronconi 2021 年 9 月 7 日
編集済み: Adam Danz 2021 年 9 月 13 日
Dear all,
I have problems with my plot. Please open the figure.
my x is in this format = '07-Sep-2021 13:02:32';
When i run this command:
set(gca, 'Xtick', (0:100:1200), 'XTickLabel', (interval(1,1):minutes(3):interval(101,1)));
I receive this output
Error using matlab.graphics.axis.decorator.DatetimeRuler/validateTicks
Value must be a vector of increasing datetime values.
Of course values in interval are in a crescent order.
How to space lines in the x-axis properly?

回答 (1 件)

Adam Danz
Adam Danz 2021 年 9 月 8 日
編集済み: Adam Danz 2021 年 9 月 13 日
"Value must be a vector of increasing datetime values."
set(gca, 'Xtick', (0:100:1200), ...
Those values above are not datetime values. They are double precision numeric values.
Assuming 'interval' contains datetime values, try,
set(gca, 'Xtick', interval(1,1):minutes(3):interval(101,1), 'xlim', interval([1,101],1))
You can set the datetime tick format using datetick.

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by