matlab 空格循环输出[m n]=size(data1);fid=fopen('F:\tp\duozhan1.txt','wt');for ind1=1:m for ind2=1:n%i=1fprintf(fid,'%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\t' ,data1(ind1,ind2));endfprintf(fid,'\n');endfclose(fid);想实现1,3,4,5,6,7,8,9,10,11,12
来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 14:13:27
matlab 空格循环输出[m n]=size(data1);fid=fopen('F:\tp\duozhan1.txt','wt');for ind1=1:m for ind2=1:n%i=1fprintf(fid,'%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\t' ,data1(ind1,ind2));endfprintf(fid,'\n');endfclose(fid);想实现1,3,4,5,6,7,8,9,10,11,12
matlab 空格循环输出
[m n]=size(data1);
fid=fopen('F:\tp\duozhan1.txt','wt');
for ind1=1:m
for ind2=1:n
%i=1
fprintf(fid,'%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\t' ,data1(ind1,ind2));
end
fprintf(fid,'\n');
end
fclose(fid);
想实现1,3,4,5,6,7,8,9,10,11,12 空格 13,14,.24每个数字之间用逗号隔开,每12个数字用空格分开.但是循环出来只有逗号,没有空格 请问各位大神是什么原因
matlab 空格循环输出[m n]=size(data1);fid=fopen('F:\tp\duozhan1.txt','wt');for ind1=1:m for ind2=1:n%i=1fprintf(fid,'%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\t' ,data1(ind1,ind2));endfprintf(fid,'\n');endfclose(fid);想实现1,3,4,5,6,7,8,9,10,11,12
[m n]=size(data1);
fid=fopen('F:\tp\duozhan1.txt','wt');
for ind1=1:m
count = 0 ;
for ind2=1:n
fprintf(fid, '%d' ,data1(ind1,ind2));
count = count + 1 ;
if( count == 12 )
fprintf(fid, ' ');
count = 0 ;
else
fprintf(fid, ',');
end
end
fprintf(fid,'\n');
end
fclose(fid);