How to save whole work space with a new file name with every iteration.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I want to save my work space with a different file name for every iteration. ?
I am calling a function Hexagon so it runs for 20 seconds and it generates some output so I want to save work space of that function with a file name start with MS_Num and then MS_Num value everytime it takes.
if true
clc
clear all
close all
sizeL = 100;
radius = 10;
Num_MS = [1500 2000 3000 4000 5000 6000 7000 8000 9000 10000];
for i = 1 : 10
MS_Num = Num_MS(i);
Hexagon(sizeL,radius,MS_Num);
end
end
I will be happy if you can guide me accordingly. Thanks
0 Commenti
Risposta accettata
Walter Roberson
il 21 Feb 2016
You cannot save the workspace of a different function than you are running in, not unless that other function is your immediate caller (though now that I think of it, that could be extended to any caller in the parent tree, though not easily.)
If you are in a function and you want to save its workspace for iteration #i then
savefile_name = sprintf('hexagon_results_%d.mat', i);
save(savefile_name);
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Whos in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!