How I make this reshape?

3 Ansichten (letzte 30 Tage)
Oscar L.C.
Oscar L.C. am 27 Mär. 2017
Beantwortet: Guillaume am 27 Mär. 2017
Hi, I am a newbie with Matlab and I want to do this:
I have this matrix:
1 1 0 1 0 0 1;
1 1 1 0 0 0 0
and after some operations i have this:
1 0 0 1 1 0 0;
1 1 0 1 1 0 0
It's the same matrix: if you read the second one vertically, you get the first matrix.
How can I reshape the second one with a "reshape instruction" to have back again the first one?
Thanks.

Akzeptierte Antwort

Guillaume
Guillaume am 27 Mär. 2017
m = [1 0 0 1 1 0 0;
1 1 0 1 1 0 0]
reshape(m, [], 2)'
That is reshape into two columns, then transpose.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by