In MATLAB, why can't I compose transpose and colon operators? -
this question has answer here:
in matlab can vector of elements of matrix in column major order using (:) operator follows...
edu>> = 1 2 3 4 5 6 edu>> a(:) ans = 1 3 5 2 4 6
however, vector of elements in row major order. figured transpose matrix before using (:). error...
edu>> a'(:) a'(:) | error: unbalanced or unexpected parenthesis or bracket.
why won't ' , (:) compose here? can in 2 steps prefer more concise , avoid variable.
edu>> b = a' b = 1 3 5 2 4 6 edu>> b(:) ans = 1 2 3 4 5 6
why can't in 1 step composing ' , (:)? right way this?
thanks, ~chuck
using reshape perhaps
reshape(a',prod(size(a)),1)
Comments
Post a Comment