Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: How to delete a row and a column in a matrix?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69706] Re: How to delete a row and a column in a matrix?
  • From: dimmechan at yahoo.com
  • Date: Thu, 21 Sep 2006 07:29:51 -0400 (EDT)
  • References: <eeqqlr$onu$1@smc.vnet.net>

Hi.

The following user defined function does what you want.

For clarity I have converted everything ro InputForm.

Clear["Global`*"]

delColRow[(x_)?MatrixQ, (n_Integer)?Positive, (m_Integer)?Positive] :=
                                          (Delete[#1, m] & ) /@
Delete[x, n]

Example

mat = Array[#1 + 2*#2 & , {4, 4}]
{{3, 5, 7, 9}, {4, 6, 8, 10}, {5, 7, 9, 11}, {6, 8, 10, 12}}


delColRow[mat, 2, 2]
{{3, 7, 9}, {5, 9, 11}, {6, 10, 12}}

delColRow[mat, 3, 2]
{{3, 7, 9}, {4, 8, 10}, {6, 10, 12}}

Cheers
Dimitris


  • Prev by Date: Re: How to delete a row and a column in a matrix?
  • Next by Date: Re: Iterative constants and variables definitions
  • Previous by thread: Re: How to delete a row and a column in a matrix?
  • Next by thread: Re: How to delete a row and a column in a matrix?