Reshape each row of matrix into separate matrices
Mostrar comentarios más antiguos
Trying to reshape each row of a 6x256 into six separate 16x16 matrices. I know how to reshape A row, but I can't get it to work in a 'for' loop to save each matrix separately:
for I=1:6
% mat=reshape(data(I,:),16,16)
end
mat keeps getting written over and mat(I) crashes. I could hard code it but... I've also looked at other row-wise Q&As and they have not helped me. Thanks.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 24 de Jul. de 2015
0 votos
cellfun(@(v) reshape(v, 16,16),mat2cell(data, ones(1,6), 256),'Uniform', 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!