Reputation: 3
How to save each output whenever I run a program without losing the previous output?
Example:
load('ii.mat','j')
k(j)=p(i);
j=j+1;
save('output','k');
save('ii',j);
This idea doesn't work. It replaces the previous value.
Upvotes: 0
Views: 54
Reputation: 36710
Use the matfile
command instead of load and save. This way, you can insert your data into the existing file:
%open or create file:
m = matfile(filename,'Writable',1)
%directly write to file:
m.k(j)=p(i)
Upvotes: 1