MATLAB: Reshape each row of matrix into separate matrices

reshaperow-wise

Trying to reshape each row of a 6×256 into six separate 16×16 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.

Best Answer

You could use a cell array. E.g.,
mat{I} = reshape(data(I,:),16,16)