In the function datenum's formatin, does the 'HH' represent the same as 'hh'?

2 ビュー (過去 30 日間)
中祥 范
中祥 范 2022 年 3 月 8 日
回答済み: Jan 2022 年 3 月 8 日
test2=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25]
newStr=num2str(test2')
num1=datenum(newStr,'hh');
num2=datenum(newStr,'HH');

採用された回答

Jan
Jan 2022 年 3 月 8 日
This is Matlab. Simply try it:
test2=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 25];
newStr=num2str(test2');
num1=datenum(newStr,'hh');
num2=datenum(newStr,'HH');
isequal(num1, num2)
ans = logical
1
Now take a look into the documentation: doc datenum . There is no 'hh" format but only 'HH'. Then Matlab tries to be polite and smart to convert your hh to HH autmatically. Prefer to stay at the documented version.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by