Error when changing datetime on Figure xlim
13 ビュー (過去 30 日間)
古いコメントを表示
I am trying to manually change the range of xlim for my figures as it plots them and on the x-axis I have datetimes. When changing the limit of the date from Feb, 03,2025, 12:00 (original format) to Feb, 01,2025, 12:00 for the end limit it gives me the error shown in the figure refering to the start month not been able to match the format. However the start date never changes from when it gives an error to when it does not give an error. The error states that the format it is looking for is 'MMM dd, u, HH:mm' and as previously said all I am changing in the limit cell is the day (from 03 to 02) and leaving everything else the same however that errors out the figure.

2 件のコメント
Steven Lord
2025 年 2 月 5 日
I don't see any "error shown in the figure" in the picture included in your post. Could you please include the full and exact text of the error message, either as a picture or as copied text?
Cris LaPierre
2025 年 2 月 5 日
編集済み: Cris LaPierre
2025 年 2 月 5 日
Here is the full error message.

A datetime is actually a serial number with a format applied to set how it is displayed. You could just change the day if the value were a string, but since it is not, it is throwing an error when you modify it in the edit field. I don't see a way to correctly update this using the Properties interface. You can do this programmatically
xlim([datetime(2025,01,31),datetime(2025,02,01)])
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Dates and Time についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!