Excel文件内数据保存结果如下:
Excel文件保存结果如下:
代码如下:
Matlab
clear;clc;
for jjjj=1:10 %这个可以改
jname=(jjjj-1)*10; %文件名中变数 这是EXCEL文件名字的一部分 根据自己需要改
jkkkk_=num2str(jname);
for iiii=1:13 %这个可以改
iname=(iiii-1)*15; % 这是EXCEL文件名字的一部分 根据自己需要改
mmmm_=num2str(iname);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ANSWER=rand(5,6); %这是要保存的数据,可以根据自己需要修改
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nnnn_=strcat('F:\新建文件夹/','竖直',jkkkk_,'_水平',mmmm_,'_22','.xlsx'); %赋值路径字符
%%%%上面这是保存到F盘新建文件夹里的
% nnnn_=strcat('F:/','竖直',jkkkk_,'_水平',mmmm_,'_22','.xlsx'); %赋值路径字符
%%%%上面这是保存到F盘里的
[~,dim]=size(ANSWER);
ANSWER=num2cell(ANSWER,dim);
varargin={};
ANSWER_name_v={'第一行';'第二行';'第三行';'第四行';'第五行'}; %单引号里 是每一行的名字 根据自己的需要更改
ANSWER_name_l={varargin,'第一列','第二列','第三列','第四列','第五列','第六列'}; %单引号里 是每一列的名字 根据自己的需要更改
ANSWERr=[ANSWER_name_l;ANSWER_name_v,ANSWER];
xlswrite(nnnn_,ANSWERr);
end
end