matlab中save、load添加路径的使用方法
原文连接:https://blog.csdn.net/m0_38103697/article/details/78246664?depth_1-
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’));
pathname = 'D:\DVS\ActionRecording\';
filename = 'white_boxing_fastly_side.bin.csv ';
save(strcat(pathname,filename, '.mat'), 'data_1' );
4、批量存储.mat文件命名方法:
tempPe = Pe*100;
storageName = strcat(‘result_’,‘Pe_’,num2str(tempPe),’.mat’);
save(storageName,‘SNR’,‘BER’);