How to reshape a 16x16x16x16 matrix to 256x256 whilst maintaining consistency
1 view (last 30 days)
Show older comments
Hi
I have a pixel grid (16,16) and I've generated a matrix A whose (i,j,k,l)th element specifies a property of the pairing of the pixel (i,j) with the pixel (k,l), for i,j,k,l = 1,...16.
Now let's say I have a separate 16-by-16 matrix "a" which I reshape to "b" such that "b = reshape(a,256,1)". I want to reshape A into a 256x256 matrix B according to this same rule, so that A(i,j,k,l) = B(m,n), where a(i,j) = b(m) and a(k,l) = b(n).
In other words, I need to reduce to a single dimension the 1,2 dimensions of A, and simultaneously the 3,4 dimensions, so that the new matrix B is consistent with all my other matrices which are consistent with the b = reshape(a,256,1) rule.
I'm far too confused to work out if this is achieved by a simple "reshape(A,256,256)", and I need to be certain before proceeding. Thanks for _any _help.
Mike
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays 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!