Look at the order the elements were returned. Do you know how the elements of a matrix are stored? DOWN THE COLUMNS. So when you reshaped the vector, it gave you the elements of column 1, then column 2, etc.
All you need to do is to TRANSPOSE THE ARRAY, BEFORE the reshape.
reshape(matrix.', [1, 9])
This has the effect of turning columns into rows, and vice versa. And that is what you need.
Understanding how the elements are stored in an array is one of the most important things you can learn as you will go forwards in MATLAB. This will help you to solve many problems.