How do I save multiple results from a function as different structures in a for loop?
1 次查看(过去 30 天)
显示 更早的评论
Hi all,
I've a function that returns multiple results in a structure (i.e results.m1, results.m2). As running this function each time is computationally intensive with many simulations within it, I am attempting to put this in a parallel computing environment, as follows:
parfor z = 1:8
results=function(x,y,z);
end
My question then is: How can I get the function to return me 8 different structures containing my results? I can't seem to get it to do so.
Would love to have some help here.
Thanks :)
0 个评论
回答(1 个)
Matt J
2013-4-30
编辑:Matt J
2013-4-30
Why not create a struct array as follows?
parfor z = 1:8
results(z)=function(x,y,z);
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!