how to flatten a matrix in row major order

1,094 views (last 30 days)
hi , how do i flatten a matrix in row major order. thanks.

Accepted Answer

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

More Answers (1)

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

Sign in to comment.

Categories

Find more on Multidimensional Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!