MATLAB Answers


how to flatten a matrix in row major order

Asked by Kaushik
on 19 Nov 2012
Latest activity Commented on by Walter Roberson
on 16 Aug 2015
Accepted Answer by Matt J

hi , how do i flatten a matrix in row major order. thanks.



No products are associated with this question.

2 Answers

Matt J
Answer by Matt J
on 19 Nov 2012
 Accepted answer


Answer by Zhendong Zhao
on 16 Aug 2015

B=A'; B(:)'

  1 Comment

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.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!