Storing Multiple Matrices from a For Loop
Mostrar comentarios más antiguos
How do I index and store multiple matrices as a run through a for loop? For instance, I generate a 10x10 matrix the first time through and I want to store this result for access later before proceeding to the next matrix generation.
Respuesta aceptada
Más respuestas (2)
Saeed Bello
el 7 de Ag. de 2017
You can use a three-dimensional matrix e.g.
for i = 1:8 % no. of iteration
S(:, :, i) = myfunx(i,10); % 10 x 10 output
end
Then you can access each iteration by calling S(:, : , 1) or S(:, : , 2) or S(:, : , 3) and so on. Source:https://stackoverflow.com/questions/30036908/output-of-for-loop-as-a-matrix-matlab
3 comentarios
Irfan Azhar
el 2 de En. de 2018
many thanks indeed.
ELIAS PERATICOS
el 27 de Abr. de 2018
Saeed Bello, thanks a lot this was very useful.
rees adah
el 31 de Oct. de 2018
I also have a similar problem but this solution didn't work for me.i intend to store the matrices coming from a nested for loop into a multidimensional array and reference it later...how do I do that please?
D.K. Rao
el 1 de Jul. de 2017
0 votos
Thank you very much Cedric Wannaz
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!