how to flatten a matrix in row major order

1.072 visualizzazioni (ultimi 30 giorni)
hi , how do i flatten a matrix in row major order. thanks.

Risposta accettata

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

Più risposte (1)

Zhendong Zhao
Zhendong Zhao il 16 Ago 2015
B=A'; B(:)'
  1 Commento
Walter Roberson
Walter Roberson il 16 Ago 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.

Accedi per commentare.

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by