Saving output of a for loop for each iteration
2 次查看(过去 30 天)
显示 更早的评论
Greetings! I'm using the following code to iterate for each trial within a file (given by condId).
u=unique(condIds,'stable');
for ii = 1:length(u)
myTrials{ii} = find(condIds == u(ii));
end
map = d.mkSaliencyMap(myTrials);
From the above code, I get map and then map_mean as follows
map_mean = mean(map,3);
Is there a way to save a new output "map_mean" for each iteration of the loop? Preferably as a .mat file?
0 个评论
回答(1 个)
SALAH ALRABEEI
2021-6-5
% code
u=unique(condIds,'stable');
for ii = 1:length(u)
myTrials{ii} = find(condIds == u(ii));
map = d.mkSaliencyMap(myTrials);
map_mean(ii,:) = mean(map,3);
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!