"...transform my matrix into a vector"
Really don't need a function for this; Matlab has syntax to do it already. A previous answer shows reshape, except I'd suggest to simply use it ( reshape, that is) inline as shown there in the function instead.
There's another Matlab idiom that's even more compact--
NB: the .' transpose operator to return the requested row vector instead of the column vector colon returns.
3 Comments
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/304749-i-am-trying-to-create-a-function-form-a-vector-from-my-matrix-and-i-do-not-understand-where-my-mista#comment_394157
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/304749-i-am-trying-to-create-a-function-form-a-vector-from-my-matrix-and-i-do-not-understand-where-my-mista#comment_394157
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/304749-i-am-trying-to-create-a-function-form-a-vector-from-my-matrix-and-i-do-not-understand-where-my-mista#comment_394160
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/304749-i-am-trying-to-create-a-function-form-a-vector-from-my-matrix-and-i-do-not-understand-where-my-mista#comment_394160
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/304749-i-am-trying-to-create-a-function-form-a-vector-from-my-matrix-and-i-do-not-understand-where-my-mista#comment_394239
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/304749-i-am-trying-to-create-a-function-form-a-vector-from-my-matrix-and-i-do-not-understand-where-my-mista#comment_394239
Sign in to comment.