How to save whole work space with a new file name with every iteration.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2016-2-21
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);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!