datenum problem with conversion
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
I have a question. I am trying to use datenum function as below. Question: why ans1=ans2? Am I using format wrongly? Thank you!
ans1 = datenum('4:30:00 PM','HH:MM:SS PM')
ans1 =
7.3670e+05
ans2 = datenum('2:30:00 PM','HH:MM:SS PM')
ans2 =
7.3670e+05
2 Commenti
Stephen23
il 19 Gen 2017
Are they the same?
>> format longg
>> datenum('4:30:00 PM','HH:MM:SS PM')
ans =
736696.6875
>> datenum('2:30:00 PM','HH:MM:SS PM')
ans =
736696.604166667
Star Strider
il 19 Gen 2017
Déjà vu
Risposte (1)
Star Strider
il 18 Gen 2017
They’r not the same. Use the format function to display the entire number in full precision:
format long g
ans1 = datenum('4:30:00 PM','HH:MM:SS PM')
ans2 = datenum('2:30:00 PM','HH:MM:SS PM')
ans1 =
736696.6875
ans2 =
736696.604166667
1 Commento
Jan
il 19 Gen 2017
Alternatively:
ans1 = datenum('4:30:00 PM','HH:MM:SS PM')
ans2 = datenum('2:30:00 PM','HH:MM:SS PM')
ans1 - ans2
% And:
(ans1 - ans2) * 86400
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!