1. matlab读入excel文件函数区别
a{1,i} = xlsread(filename{i},'A2:G2881');%读取excel文件,选定区域'B2:T2881'
都只能读取excel表中为数值的内容,假如 日期则忽略或NaN
a{1,i} = xlsread(filename{i},‘A2:G2881’);%读取excel文件,选定区域’B2:T2881’
=readmatrix()
readtable可保留表头和各种格式
bb = readtable(filename{i},‘Range’,‘A2:G2881’);%读取excel文件,选定区域’B2:T2881’
拼接/完成后再存为excel,excel中处理(如:日期转为数值),再重新导入matlab
%同一文件夹下多csv表拼接
path = 'E:\xxxx\';
namelist = dir([path,'*.csv']);
L = length(namelist);
a = [];
for i = 1:L
filename{i} = [path,namelist(i).name];
bb = readtable(filename{i},'Range','A2:G2881');%读取excel文件,选定区域'B2:T2881'
a= [a;bb];
namelist(i).name;
end
writetable(a, '汇总前6tags.csv'); %table (2880*#{day})*#{tags},存为新