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

2 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Matt J
Matt J el 13 de Nov. de 2012
Editada: Matt J el 13 de Nov. de 2012
Yes, it's the same. But you can easily convince yourself using a few simple tests.

Más respuestas (0)

Categorías

Más información sobre Image Filtering and Enhancement en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by