MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Matrix Manipulation: deletion of rows and columns

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49301] Re: Matrix Manipulation: deletion of rows and columns
  • From: BobHanlon at aol.com
  • Date: Tue, 13 Jul 2004 04:32:32 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

dropCol[mat_List?(!VectorQ[#]&), colNbr_Integer] :=
     
     Drop[#, {colNbr}]& /@ mat;

dropCol[mat_List?(!VectorQ[#]&), colNbr_?VectorQ] :=
     
     Fold[dropCol[#1,#2]&, mat, Sort[Union[colNbr], Greater]];


dropRow[mat_List?(!VectorQ[#]&), rowNbr_Integer] :=
     Drop[mat, {rowNbr}];

dropRow[mat_List?(!VectorQ[#]&), rowNbr_?VectorQ] :=
     
     Fold[dropRow[#1,#2]&, mat, Sort[Union[rowNbr], Greater]];


mat1 = Array[a, {7,7}];


dropRow[dropCol[mat1,{1,4,5,7}],{2,3,4,6}]


{{a[1, 2], a[1, 3], a[1, 6]}, {a[5, 2], a[5, 3], a[5, 6]}, {a[7, 2], a[7, 3], 
a[7, 6]}}



Bob Hanlon

> In a message dated Mon, 12 Jul 2004 06:26:28 +0000 (UTC), 
> mbekkali at gmail.com writes: Is there a way to delete rows or/and columns of a 
> matrix, say delete
> rows 2,4 and 6,17 of 20x20 matrix and form a new matrix from the
> remaining rows and columns.
> 


  • Prev by Date: AW: Matrix Manipulation: deletion of rows and columns
  • Next by Date: Solving the variable system of equations
  • Previous by thread: RE: Matrix Manipulation: deletion of rows and columns
  • Next by thread: a noise with a better histogram