MathGroup Archive 2009

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

Search the Archive

Re: Deleting entire row and/or column

  • To: mathgroup at smc.vnet.net
  • Subject: [mg98196] Re: Deleting entire row and/or column
  • From: Raffy <raffy at mac.com>
  • Date: Thu, 2 Apr 2009 04:47:13 -0500 (EST)
  • References: <gr0ghk$950$1@smc.vnet.net>

On Apr 1, 12:50 pm, KFUPM <hussain.alqaht... at gmail.com> wrote:
> Dear all
>
> I have large matrices having entire rows and/or columns of zeros and I
> want to delete those zero rows and columns. My question, what is the
> best (most compact) command to use in Mathematica. Please note that
> the value of zero is the real zero i.e 0.0000 not just 0.
>
> Regards,

matKill0[m_?MatrixQ] :=
  Part[m, Pick[Range@Length[m], Equal[0, ##] & @@@ m, False],
   Pick[Range@Length@First[m], MapThread[Equal[0, ##] &, m], False]];


  • Prev by Date: Joust in Mathematica
  • Next by Date: Re: pdf export problem
  • Previous by thread: Re: Deleting entire row and/or column
  • Next by thread: Re: Deleting entire row and/or column