how to flatten a matrix in row major order

1.072 Ansichten (letzte 30 Tage)
Kaushik
Kaushik am 19 Nov. 2012
Kommentiert: Walter Roberson am 16 Aug. 2015
hi , how do i flatten a matrix in row major order. thanks.

Akzeptierte Antwort

Matt J
Matt J am 19 Nov. 2012
reshape(A.',1,[])

Weitere Antworten (1)

Zhendong Zhao
Zhendong Zhao am 16 Aug. 2015
B=A'; B(:)'
  1 Kommentar
Walter Roberson
Walter Roberson am 16 Aug. 2015
Using ' instead of .' makes extra work because ' is conjugate transpose. Your code does the conjugate transpose twice so you do end up with the original values, but it is work that doesn't have to be done.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Multidimensional 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