In MATLAB I can easily get a vector of the elements of a matrix in column major order using the (:) operator as follows...
EDU>> A
A =
1 2
3 4
5 6
EDU>> A(:)
ans =
1
3
5
2
4
6
However, I would like to get a vector of the elements in row major order. So i figured I would transpose the matrix before using (:). But I get this error...
EDU>> A'(:)
A'(:)
|
Error: Unbalanced or unexpected parenthesis or bracket.
Why won't ' and (:) compose here? I can do it in 2 steps but I would prefer to be more concise and avoid the extra variable.
EDU>> B = A'
B =
1 3 5
2 4 6
EDU>> B(:)
ans =
1
2
3
4
5
6
Why can't I do this in 1 step by composing ' and (:)? What is the right way to do this?
Thanks, ~chuck