Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

How to do count for sub list?????

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82095] How to do count for sub list?????
  • From: wangzhen0829 at gmail.com
  • Date: Fri, 12 Oct 2007 02:50:56 -0400 (EDT)

Hallo, everyone

I am new to Mathematica, and now I have a problem with it, hope to get
some help from here.

I have a

{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {
  0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {
  0, 0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 1, 0, 0, 0, 0, 0}}



I need to get a list which represent the number of NON-zero number in
each sublist.

I should get a list like:

{0,0,1,1,0,0,1,1}

Thank you!



  • Prev by Date: Re: [Mathematica 6] Format->Magnification does not work on notebook
  • Next by Date: Unwanted resize of frontend window
  • Previous by thread: Re: Hiding Input Cells
  • Next by thread: Re: How to do count for sub list?????