How to save "for" loop outputs in cell array?
Afficher commentaires plus anciens
I generated a code that gives all the 2x2 submatrices from a 10x7 matrix while keeping the order. I want to save each output (submatrix) as a matrix in a cell array to view it later. Here's my code:
Any help is appreciated!
clear
clc
matrix=rand(10,7)
[r, c]= size(matrix);
for s=1:r-1
for n=s+1:r-s
for j=1:c
for i=j+1:c
submatrix=matrix([s n],[j i])
end
end
end
end
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!