MATLAB: How to turn an 1x1x3 array to a 1×3 vector

arrayvector

Various manipulations I perform in my script create a 1x1x3 array which I then need to produce a dot product with a 1×3 vector. That's not playing together so I need to turn my 1x1x3 array into a 1×3 vector. I figure I can use vector=[array(1,1,1), array(1,1,2), array(1,1,3) ]; but I don't like how that looks and figure I could cut a line out if there was a function call that does the same thing. I assume there is one because this seems like something an existing function call would do but I cannot find it. Is there something I could use instead of vector=[array(1,1,1), array(1,1,2), array(1,1,3) ];?

Best Answer

reshape(array,1,[]) % or squeeze() transposed