Results 1 to 2 of 2

Math Help - Changing the order of matrix in Matlab

  1. #1
    Junior Member
    Joined
    Apr 2010
    From
    USA
    Posts
    31

    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:
    \begin{pmatrix}1&2&3&4\\5&6&7&8\end{pmatrix}

    I want the function to change the order to:
    \begin{pmatrix}3&4&1&2\\7&8&5&6\end{pmatrix}

    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.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Junior Member
    Joined
    Apr 2010
    From
    USA
    Posts
    31

    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
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. changing the order of integration
    Posted in the Calculus Forum
    Replies: 13
    Last Post: February 17th 2010, 05:00 PM
  2. matlab changing time scale on a waveform
    Posted in the Math Software Forum
    Replies: 3
    Last Post: July 27th 2009, 09:06 AM
  3. Changing the order of integration
    Posted in the Calculus Forum
    Replies: 7
    Last Post: November 20th 2008, 09:30 AM
  4. Changing order of integration?
    Posted in the Calculus Forum
    Replies: 1
    Last Post: October 20th 2008, 01:39 PM
  5. Changing order of integration
    Posted in the Calculus Forum
    Replies: 1
    Last Post: April 27th 2008, 06:13 AM

Search Tags


/mathhelpforum @mathhelpforum