fid=fopen('D:\数学建模\s1.txt','wt');
Sl=length(S);%S为包含13个矩阵的元胞
for k=1:13
[row,col]=size(S{k});
fprintf(fid,'%g\n\n',k);
for i=1:row
for j=1:col
if(j==col)
fprintf(fid,'%g\n',S{k}(i,j)); %换行
else
fprintf(fid,'%g\t',S{k}(i,j)); %tab(多个空格)
end
end
end
fprintf(fid,'\n\n');
end
fclose(fid);