want to use output matrix obtained for every iteration of a for loop in another for loop.
Afficher commentaires plus anciens
hi, i am developing a code where i have 2 functions: the first function gives me a smaller matrix 'k'.
i want to obtain this 'k' matrix for every iteration.
then i want to add these smaller matrices into a larger one, for that i am using the second for loop.
can anyone please guide me on how i can save each 'k' matrix after every iteration, and then use the 'k' matrices and add them to a larger matrix 'K'?
6 commentaires
the cyclist
le 14 Avr 2024
It is unclear to me what you mean by "add them to a larger matrix". Are you summing the small matrices? Or are they submatrices of the larger one? Or something else?
A small example of what you mean would help.
J
le 15 Avr 2024
the cyclist
le 15 Avr 2024
We need more details. Are all of the smaller matrices the same size? Do you already know the row and column numbers where they go, or do you need to calculate them?
J
le 15 Avr 2024
posr = 4;
posc = 3;
m = rand(6);
M = zeros(120);
M(posr:posr+5,posc:posc+5) = m
J
le 16 Avr 2024
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!