MATLAB 代码:将 Excel 时间数据拆分成年月日时分
clear; %清除工作区变量 filename = 'D:\7ktz_files\2023十九中教室空气质量数据\IAQ2forexcel.xlsx'; %excel文件路径 data = xlsread(filename, 1); %读取第一个工作表的数据 time = data(:,1); %取第一列时间数据 year = floor(time/100000); %取年份 month = floor((time-year100000)/1000); %取月份 day = floor((time-year100000-month1000)/10); %取日期 hour = time-year100000-month1000-day10; %取小时 minute = mod(data(:,1),1)*100; %取分钟 output = [year, month, day, hour, minute]; %合并为一个矩阵 xlswrite('D:\7ktz_files\2023十九中教室空气质量数据\2.xlsx', output, 'Sheet1'); %写入excel文件 disp('数据已保存至D:\7ktz_files\2023十九中教室空气质量数据\2.xlsx'); %输出提示信息
AI 优化版
原文地址:https://www.cveoy.top/t/topic/m163 著作权归作者所有。请勿转载和采集!