How to move decimal to the right?
3 次查看(过去 30 天)
显示 更早的评论
I have a time variable that is supposed to formatted as yymmdd.xxxx where xxxx is the fraction of the day. However, the variable is displayed as y.ymmddxxxxx. How do I move the decimal to the right so its formatted correctly?
2 个评论
DGM
2021-10-4
编辑:DGM
2021-10-4
If the date is represented as a floating point numeric class, why can't you just multiply it by the appropriate value? -- or are you just looking at the number expressed in scientific notation?
format long
D = 1.1223344444 % assuming the number is as described
D = D.*1E5 % the number is now as requested, but it displays in scientific notation
fprintf('%.5f\n',D) % display it differently (it's still the same number)
Walter Roberson
2021-10-4
Sounds like a floating point time variable... this problem would not happen with datetime objects.
回答(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!