Reputation: 19
Im Working on Simulation Dehumidification Process, i should save .Mat file in every loop, my program flowchart is:
enter code here
for m=9:2:21
for kk=1:ll
for jj=1:mm
for ii=1:nn
...
...
...
end
end
end
A=min(X-Y)
end
for example mm=9 then A=1 mm=11 then A=2 ..., How i can Plot A with mm? and How i can Save .Mat file in every mm iteration? Thanks.
Blockquote %A=(7*1)Matrix %9:2:21=7(Number)
Upvotes: 0
Views: 296
Reputation: 344
If you want to save a .mat-file for each iteration the only thing you need to do is to generate a unique filename for each iteration within the loop. This can be done using format strings, for instance in your case something like
filename = sprintf('output_kk=%d_jj=%d_ii=%d.mat', [kk jj ii]);
save(filename);
You have the option to save specific variables by adding them as options to the save
command. For more about string formatting I'd suggest you check out the sprintf
documentation.
I'm not sure whether this is the most efficient way to do it. Depending on the number and size of output variables you're interested in you can also create a cell structure and save your data into a new cell for each iteration.
Upvotes: 1