How to save whole work space with a new file name with every iteration.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Arsal15
el 21 de Feb. de 2016
Comentada: Arsal15
el 21 de Feb. de 2016
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 comentarios
Respuesta aceptada
Walter Roberson
el 21 de Feb. de 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);
Más respuestas (0)
Ver también
Categorías
Más información sobre Whos en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!