Display time on x axis
142 次查看(过去 30 天)
显示 更早的评论
Hello !
I have some readings taken at different time. I want to plot these values against time with steps of 20 seconds. Time limit is from 00:00:00 to 23:59:59. How i can insert time format on X axis.
0 个评论
采纳的回答
Star Strider
2019-9-11
It depends on what options you have.
Note that the date and time formats for the two functions are (frustratingly) different, so a datetime format will not work with datetick, nor datetick format with datetime.
2 个评论
Star Strider
2019-9-13
I actually have no idea because you have not presented enough information.
Try this example:
A = {'01:12:45', 21; '12:34:56', 42; '13:14:15', 84}; % Create Array
t = datenum(A(:,1), 'HH:MM:SS');
data = [A{:,2}];
figure
plot(t, data)
datetick('x', 'HH:MM:SS', 'keeplimits')
更多回答(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!