Changing the order of matrix in Matlab

Can anyone help me with a code to change the order of a given matrix. For example given the following matrix:

I want the function to change the order to:

The matrix is basically being divided into frames. I guess you can find the number of frames by dividing the number of columns by number of rows. So for this matrix it would be 2 frames.

I can only manage to get the first frame.

Re: Changing the order of matrix in Matlab

- function rewind(F)
- [m,n]=size(F);
- frames=n/m; %Number of frames
- C=[];
- for i=1:frames,
- B=F(:,(m*(i-1))+1:m*i);
- C=[B C];
- end
- C