Changed the behaviour of @dynSeries/save method when the chosen file name corresponds to an existing file in the same folder.
parent
cb5cb03750
commit
7459a5dcbb
|
@ -29,10 +29,9 @@ end
|
||||||
switch format
|
switch format
|
||||||
case 'm'
|
case 'm'
|
||||||
if exist([basename, '.m'],'file')
|
if exist([basename, '.m'],'file')
|
||||||
fid = fopen([basename, '.new', '.m'],'w');
|
copyfile([basename, '.m'],[basename, '.old.m'])
|
||||||
else
|
|
||||||
fid = fopen([basename, '.m'],'w');
|
|
||||||
end
|
end
|
||||||
|
fid = fopen([basename, '.m'],'w');
|
||||||
fprintf(fid,'%% File created on %s.\n',datestr(now));
|
fprintf(fid,'%% File created on %s.\n',datestr(now));
|
||||||
fprintf(fid,'\n');
|
fprintf(fid,'\n');
|
||||||
fprintf(fid,'FREQ__ = %s;\n',num2str(A.freq));
|
fprintf(fid,'FREQ__ = %s;\n',num2str(A.freq));
|
||||||
|
@ -71,17 +70,14 @@ switch format
|
||||||
end
|
end
|
||||||
eval(str);
|
eval(str);
|
||||||
if exist([basename, '.mat'],'file')
|
if exist([basename, '.mat'],'file')
|
||||||
save([basename '.new.mat'],'INIT__','FREQ__','NAMES__','TEX__',A.name{:});
|
copyfile([basename, '.mat'],[basename, '.old.mat'])
|
||||||
else
|
|
||||||
save([basename '.mat'],'INIT__','FREQ__','NAMES__','TEX__',A.name{:});
|
|
||||||
end
|
end
|
||||||
|
save([basename '.mat'],'INIT__','FREQ__','NAMES__','TEX__',A.name{:});
|
||||||
case 'csv'
|
case 'csv'
|
||||||
if exist([basename, '.csv'],'file')
|
if exist([basename, '.csv'],'file')
|
||||||
fid = fopen([basename, '.new', '.csv'],'w');
|
copyfile([basename, '.csv'],[basename, '.old.csv'])
|
||||||
else
|
|
||||||
fid = fopen([basename, '.csv'],'w');
|
|
||||||
end
|
end
|
||||||
|
fid = fopen([basename, '.csv'],'w');
|
||||||
fprintf(fid,',%s', A.name{:});
|
fprintf(fid,',%s', A.name{:});
|
||||||
fprintf(fid,'\n');
|
fprintf(fid,'\n');
|
||||||
for t=1:A.nobs
|
for t=1:A.nobs
|
||||||
|
|
Loading…
Reference in New Issue