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)])

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值