Azzera filtri
Azzera filtri

I have n*n matrix.I want to get all the elements of 1st column of nth rows like A(:,1). Now how will i arrange all the n elements into a single row i,e b=[A(1,1) A(2,1) A(3,1)............ A(n,1)].What will be the command for n being large say 5000?

6 visualizzazioni (ultimi 30 giorni)
I have n*n matrix.I want to get all the elements of 1st column of nth rows like A(:,1). Now how will i arrange all the n elements into a single row i,e b=[A(1,1) A(2,1) A(3,1)............ A(n,1)].What will be the command for n being large say 5000?

Risposta accettata

Stephen23
Stephen23 il 14 Mag 2018
Modificato: Stephen23 il 14 Mag 2018
The most general, correct answer is to use transpose .' (rather than conjugate transpose '):
A(:,1).'
  2 Commenti
phoenix
phoenix il 14 Mag 2018
what is the difference between transpose and conjugate transpose(i.e between A(:,1).'and A(:,1)' ) ?
James Tursa
James Tursa il 14 Mag 2018
Modificato: James Tursa il 14 Mag 2018
If A is real, there is no difference in the result. If A is complex, then ' will conjugate the elements (i.e., negate the imaginary part), whereas .' will not conjugate the elements.

Accedi per commentare.

Più risposte (1)

KSSV
KSSV il 14 Mag 2018
b = A(:,1)' ;

Community Treasure Hunt

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

Start Hunting!

Translated by