我是靠谱客的博主 精明小懒猪,这篇文章主要介绍matlab1分钟数据转5分钟,matlab – 关于分钟的格式化时间(min.sec),现在分享给大家,希望可以做个参考。

您可以使用

xtickformat指定x标签的所需格式,如下所示:

% generate a random signal (in seconds)

t = 0:5:15*60;

y = rand(size(t));

plot(seconds(t),y) % plot your signal, making it explicit that the t is expressed in seconds

xtickformat('mm:ss') % specify the desired format of the x labels

请注意,我使用seconds方法返回一个duration对象,以向Matlab指示t以秒为单位表示.

上述脚本的输出是(右图像是左图像的缩放版本):

b58d96117d208aa11aa5bede3f5235b6.png

023b4f182fdee94abf4120052d5a94c0.png

前R2016b

可以使用datetime而不是xtickformat,如下所示:

datetimes = datetime(0,0,0,0,0,t); % convert seconds to datetime

plot(datetimes,y)

datetick('x', 'MM:SS'); % set the x tick format (Note that you should now use capital M and S in the format string

xlim([min(datetimes) max(datetimes)])

最后

以上就是精明小懒猪最近收集整理的关于matlab1分钟数据转5分钟,matlab – 关于分钟的格式化时间(min.sec)的全部内容,更多相关matlab1分钟数据转5分钟,matlab内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(121)

评论列表共有 0 条评论

立即
投稿
返回
顶部