The Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.


Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Deleting entire row and/or column
Replies: 10   Last Post: Apr 5, 2009 6:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
raffy@mac.com

Posts: 124
Registered: 9/23/08
Re: Deleting entire row and/or column
Posted: Apr 2, 2009 5:47 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Apr 1, 12:50 pm, KFUPM <hussain.alqaht...@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]];




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.