您可以使用
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以秒为单位表示.
上述脚本的输出是(右图像是左图像的缩放版本):


前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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复