原文http://blog.sina.com.cn/s/blog_69e6c00301018wn0.html
1 、添加存储路径:
workpath = strcat(filesep,'tmp',filesep,'example_',datestr(now,'yymmdd'),'_',datestr(now,'HHMM')); if (~isunix)workpath = strcat('.',workpath);
end
if (exist(workpath))
error('The working dir already exist');
else
mkdir(workpath);
end
SIM_DIR = workpath;
2、创建存储目录:
filename = strcat('D:\存储文件夹名\example.txt');
fid = fopen(filename,'at');
fprint(fid,'Length = %d BER = %f\n',BER ,SNR);
fprint(fid,'SNR Rot\n');
fclose(fid);
...
fid = fopen(filename,'at');
fprint(fid,'%f %f\n',SNR,Rot);
fclose(fid);
3、save和load的使用方法:
save(strcat('D:\存储文件夹名\',filesep,'example','.mat'),'data');
load(strcat('D:\存储文件夹名\',filesep,'example','.mat'));
4、批量存储.mat文件命名方法:
tempPe = Pe*100;
storageName = strcat('result_','Pe_',num2str(tempPe),'.mat');
save(storageName,'SNR','BER');