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

delmat

PURPOSE ^

DELMAT Delete vector or matrix entries from matrix.

SYNOPSIS ^

function B=delmat(A,idx,dim)

DESCRIPTION ^

DELMAT  Delete vector or matrix entries from matrix.
   DELMAT(X), returns X.
   DELMAT(X,I), removes the row vectors at rows I in matrix X.
      If I is an empty vector, X will be returned.
      In the indices I, only real parts are concidered and if they
      are not integers then they will be rounded off. Indices can be a
      logical array (see examples).
   DELMAT(X,I,DIM), removes vector entries along dimension DIM.
      If DIM is a singleton dimension, X will be returned.
      Likewise if DIM < 1 or DIM > ndims(X), nothing will happen.
  Best option: @Reza
  delmat(givenmatrix,rowcol,dim)
 where givenmatrix is the matrix, whose elements is to be deleted
 rowcol is the row/column number in a number or in a vector form, like 1,
 [1 2 3 7]
 dim is the direction, 1 for row and 2 for column. If dim = null, dim = 1;
   Examples:
      X=rand(4,3,2)            %X is 4x3x2.
      Y=delmat(X,[1 3])        %removes row 1 and 3.
      size(Y)                  %Y will be 2x3x2.
      Y=delmat(X,2:3,2)        %removes column 2 and 3.
      size(Y)                  %Y will be 4x1x2.
      Y=delmat(X,2,3)          %removes "vector" 2 along dimension 3.
      size(Y)                  %Y will be 4x3.
      X=1:5
      delmat(X,1<X & X<5,2)    %returns [1 5].
      X=[1 1 1;1 1 2;1 2 3;2 3 3;3 3 3]
      delmat(X,any(X==2,2),1)  %returns [1 1 1;3 3 3].

   See also INSMAT, ROTMAT, SHIFTMAT, REPMAT, RESHAPE, FLIPDIM.

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