Re: HELP: How to do count to the SUB-LIST
- To: mathgroup at smc.vnet.net
- Subject: [mg82143] Re: [mg82096] HELP: How to do count to the SUB-LIST
- From: "Curtis F. Osterhoudt" <cfo at lanl.gov>
- Date: Sat, 13 Oct 2007 03:50:52 -0400 (EDT)
- References: <200710120651.CAA04299@smc.vnet.net>
- Reply-to: cfo at lanl.gov
Hello, Zhen, You'll probably get a lot of answers. This one seems sufficiently general to take care of the different lists you might encounter: Count[#, Except[0]]&/@ list should give you what you want. Cheers! > Hallo, everyone > > I am new to Mathematica, and I get one problem now, hope to get some > help here > > I got a list like this: > > {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 0, 0, 0, 1, 0, 0, 0}, > {0, 0, 0, 0, 1, 1, 0, 0, 2, 0}, {1, 0, 1, 0, 0, 1, 0, 1, 0, 0}, > {1, 3, 3, 4, 2, 2, 5, 3, 2, 1}, {7, 2, 2, 3, 4, 4, 0, 3, 1, 3}} > > I need to get a list to show the number of non zero number in each sub > list, as to say, I need to get a list like this: > > {0,3,3,4,10,9} > > Thanks alot! > > >
- References:
- HELP: How to do count to the SUB-LIST
- From: zhen <wangzhen0829@gmail.com>
- HELP: How to do count to the SUB-LIST