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

 Réponse acceptée

per isakson
per isakson le 9 Juin 2019
Modifié(e) : per isakson le 9 Juin 2019

0 votes

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

Plus de réponses (2)

TADA
TADA le 9 Juin 2019

0 votes

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

1 commentaire

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by