Site hosted by Angelfire.com: Build your free website today!

shiftr

PURPOSE ^

PURPOSE:

SYNOPSIS ^

function y = shiftr(A,row,shift,type)

DESCRIPTION ^

  PURPOSE:
  --------
  y = shiftr (A, row, shift) moves #row of matrix A to the right
                                by #shift positions. 

  INPUT ARGUMENTS:
  ----------------
  'A' is the input matrix. ('A' can be a vector)

  'row' is the number of the row to be shifted. If 'row' is zero,
  then all rows in the matrix are shifted.

  'shift' is the number of positions by which the row is shifted
  to the right.

  'type' is an optional argument.

         The shifted matrix-elements are discarded if this argument 
         is 0 or is omitted,
         then vacated spaces to the left are filled with zeroes.
  
         The shifted matrix-elements are retained if 'type' is 1 
         or any other non-zero value,
         then vacated spaces to the left are filled with the shifted
         row-elements from the right (i.e. "wraparound").

  EXAMPLES:   A = [1 2 3 4 5;
  ---------        6 7 8 9 0]

              y = shiftr(A,0,2)   --> [0 0 1 2 3;
                                       0 0 6 7 8]
              y = shiftr(A,1,2)   --> [0 0 1 2 3;
                                       6 7 8 9 0]
              y = shiftr(A,1,2,0) --> [0 0 1 2 3;
                                       6 7 8 9 0]
              y = shiftr(A,1,2,1) --> [4 5 1 2 3;
                                       6 7 8 9 0]
              y = shiftr(A,0,2,1) --> [4 5 1 2 3;
                                       9 0 6 7 8]
              B = [1 2 3 4 5]

              z = shiftr(B,1,3)   --> [0 0 0 1 2]

  SEE ALSO:  shiftl, shiftu, shiftd.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^


Generated on Sat 12-Mar-2005 01:01:49 by Rezaul Karim © 2004