Reshape each row of matrix into separate matrices
Show older comments
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.
Accepted Answer
More Answers (1)
Walter Roberson
on 24 Jul 2015
0 votes
cellfun(@(v) reshape(v, 16,16),mat2cell(data, ones(1,6), 256),'Uniform', 0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!