How to reshape a 16x16x16x16 matrix to 256x256 whilst maintaining consistency

1 次查看(过去 30 天)
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

采纳的回答

Matt J
Matt J 2012-11-13
编辑:Matt J 2012-11-13
Yes, it's the same. But you can easily convince yourself using a few simple tests.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Filtering and Enhancement 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by