原文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');
本文介绍了在MATLAB中进行文件操作的方法,包括如何创建存储路径、建立存储目录、使用save和load函数保存及加载.mat文件,以及批量存储.mat文件的命名方式。
1689

被折叠的 条评论
为什么被折叠?



