How to save "for" loop outputs in cell array?
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices 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!