1.文件写入、读取
%% 写入
fin=fopen('.\df_txt\Data.txt','a+');
% fin=fopen('.\df_txt\Data.txt','a+');
fprintf(fin,'\r\n ------------------------------ \r\n');
fprintf(fin,'%d\t%d\t%d\t%d\t%d\t%d\r\n',fix(clock));
fprintf(fin,'%d %d %d %d \r\n',Boxin);
% fprintf(fin,'boxpara.s \r\n');
% fprintf(fin,'featkindpara: \r\n');
fclose(fin);
%%
dlmwrite('sample_result.txt',groundtruth_matrix,'precision','%10.0f');
%%
a =[17 24 1 8 15;23 5 7 14 16 ;4 6 13 20 22 ;10 12 19 21 3 ;11 18 25 2 9 ];
save afile.txt -ascii a
afile.txt打开之后,是这样的:
1.7000000e+001 2.4000000e+001 1.0000000e+000 8.0000000e+000 1