clear;clc;

%读取excel文件 filename='D:\7ktz_files\2023十九中教室空气质量数据\IAQ2forexcel.xlsx'; sheetname='Sheet1'; num=xlsread(filename,sheetname);

%把时间数据拆分为年、月、日、小时、分钟 year=floor(num(:,1)/1e8); %取整 month=floor(mod(num(:,1),1e8)/1e6); day=floor(mod(num(:,1),1e6)/1e4); hour=floor(mod(num(:,1),1e4)/1e2); minute=mod(num(:,1),1e2);

%生成新的excel文件并写入数据 newfilename='D:\7ktz_files\2023十九中教室空气质量数据\2.xlsx'; header={'年','月','日','小时','分钟'}; xlswrite(newfilename,header,1,'A1'); xlswrite(newfilename,[year,month,day,hour,minute],1,'A2');

我的excel位于D7ktz_files2023十九中教室空气质量数据IAQ2forexcelxlsx。第一列是时间数据格式是年、月、日、小时、分连在一起。从左到右前四个数是年份第五和第六个数代表月第七和第八个数代表日第九和第十个数代表小时第十和第十一个数代表分。例如202302270658代表着2023年02月27号06小时58分钟。我要把第一列数据中的年、月、日、小时、分钟全部拆分为不同列并且

原文地址: https://www.cveoy.top/t/topic/bx9Z 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录