Saving output of a for loop for each iteration

1 visualización (últimos 30 días)
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran el 5 de Jun. de 2021
Comentada: Kevin Akash Rajasekaran el 5 de Jun. de 2021
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?

Respuestas (1)

SALAH ALRABEEI
SALAH ALRABEEI el 5 de Jun. de 2021
% 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 comentario
Kevin Akash Rajasekaran
Kevin Akash Rajasekaran el 5 de Jun. de 2021
Thanks! And what should I do if I want to save multiple map_mean variables for each iteration?

Iniciar sesión para comentar.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by