customizing the index of reshape A 2X2 matrix

1 visualización (últimos 30 días)
ali akbar
ali akbar el 6 de Sept. de 2020
Comentada: ali akbar el 6 de Sept. de 2020
So I have a 2x2 matrix
test=[1 2;16 9]
y=reshape(test,[],1)
which returns
1
16
2
9
I want it to reshape like this
1
2
16
9
Any suggestion would be highly appreciated.

Respuesta aceptada

madhan ravi
madhan ravi el 6 de Sept. de 2020
Transpose Test before reshaping.
  2 comentarios
madhan ravi
madhan ravi el 6 de Sept. de 2020
y = reshape(test.', [], 1)
ali akbar
ali akbar el 6 de Sept. de 2020
Thank you madhan. I just realized how naive I was, I haven't thought about this simple thing beforehand.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices 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