How do i get Char into Double
2 次查看(过去 30 天)
显示 更早的评论
Hello,
Does anyone know how i get timeinformation saved as a char into a double? I want to plot something over a time (HH:MM:SS) i got the information as a Workspace variable but as a class. I need it as an double to plot it.
thanks
0 个评论
回答(2 个)
Image Analyst
2016-3-31
Use datenum(). From the help:
format long
t = [datetime('now');datetime('tomorrow')]
DateNumber = datenum(t)
t =
07-Jan-2016 15:42:14
08-Jan-2016 00:00:00
DateNumber =
1.0e+05 *
7.363366543368312
7.363370000000000
2 个评论
Image Analyst
2016-3-31
You can make the tick marks whatever list of strings you want:
ax = gca;
ax.XTickLabel = yourCellArrayOfTimeStrings;
Example from the help:
ax.XTickLabel = {'-3\pi','-2\pi','-\pi','0','\pi','2\pi','3\pi'};
另请参阅
类别
在 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!