- 积分
- 3464
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2019-8-31
- 最后登录
- 1970-1-1
![未绑定新浪微博用户 新浪微博达人勋](source/plugin/sina_login/img/gray.png)
|
发表于 2022-3-29 14:29:01
|
显示全部楼层
用时间表(timetable)吧,很简单的,循环就没必要了,写了一下你那个数据,有段时间数据是缺测没有的,这个也可以用retime()插值回来,具体你自己选择做进行做好了
% 设置表格读取形式
opts = detectImportOptions('data.xlsx');
opts.VariableNames = {'year', 'month', 'day', 'hour', 'minute', 'second', 'LWP'};
T = readtable('data.xlsx', opts);
% 创建时间表中的时间行和时间表
time = datetime(T.year, T.month, T.day, T.hour, T.minute, T.second);
TT = table2timetable(table(T.LWP), 'RowTimes', time);
TT.Properties.VariableNames = {'LWP'} ;
% 使用retime()进行聚类分析
LWP_hourly = retime(TT, 'hourly', 'mean');
stackedplot(LWP_hourly)
|
|