%%% 写excel 文件测试
clear
clc
title = cell(1,3);%% 表头
title{1} = 'a';
title{2} = 'b';
title{3} = 'c';
xlswrite('str.xls',title);%% 写表头
%%
colNum1 = 'A';%% 起始列
colNum2 = 'C';%% 结束列
rowNum = 10; %% 行数
for iter =1:20
C = iter:iter+3;
Con = num2cell(C);
rowNum = iter + 1;
colNum = [colNum1,num2str(rowNum),':',colNum2,num2str(rowNum)];%% 范围
xlswrite('str.xls',Con,colNum);%% 写入指定行
end
效果如下图