Hello everyone,
I have an A matrix as
A=[a b ; c d ; e f ; g h]
and want to get B matrix as
B=[a ; b; c; d; e; f; g; h]
using A matrix. How can I code it? Thanks

 Akzeptierte Antwort

per isakson
per isakson am 9 Jun. 2019
Bearbeitet: per isakson am 9 Jun. 2019

0 Stimmen

One way
z = permute( A, [2,1] );
B = z(:);
or
z = permute( A, [2,1] );
B = reshape( z, [],1 );

Weitere Antworten (2)

TADA
TADA am 9 Jun. 2019

0 Stimmen

B = reshape(A',numel(A),1)

1 Kommentar

Walter Roberson
Walter Roberson am 9 Jun. 2019
A' is only correct for real valued entries, as it is the conjugate transpose.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Matrices and Arrays finden Sie in Hilfe-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