필터 지우기
필터 지우기

Saving output of a for loop for each iteration

조회 수: 1 (최근 30일)
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran 2021년 6월 5일
댓글: Kevin Akash Rajasekaran 2021년 6월 5일
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?

답변 (1개)

SALAH ALRABEEI
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
  댓글 수: 1
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran 2021년 6월 5일
Thanks! And what should I do if I want to save multiple map_mean variables for each iteration?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by