[Date Index]
[Thread Index]
[Author Index]
Re:Count inside a matrix?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg128022] Re:Count inside a matrix?
*From*: "ced.fuhrer" <ced.fuhrer at laposte.net>
*Date*: Sun, 9 Sep 2012 05:11:07 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: l-mathgroup@wolfram.com
*Delivered-to*: mathgroup-newout@smc.vnet.net
*Delivered-to*: mathgroup-newsend@smc.vnet.net
*Reply-to*: "ced.fuhrer" <ced.fuhrer at laposte.net>
Hi sergio!
Maybe an example could help to know what you want but: a matrix is a list of list so if
you specify the level in which you are seeking a number (or anything else...) you have
the result:
Count[{{a, a, b}, {b, a, a}, {a, b, a}}, b, 2] returns 3 (because 3 'b' appear )
Count[{{1, 2, 3}, {4, 5, 6}, {3, 3, 3}}, 3, 2] returns 4 (there are four 3 in level2 in
this matrix)
Count[{{1, 2, 3}, {4, 5, 6}, {3, 3, 3}}, 3] returns 0 (there are no 3 in level1 in this
matrix)
Count[{{1, 2, {3, 2, 1}}, {4, 5, 6}, {3, {3}, 3}}, 3, 2] returns 2 (there are two 3 in
level2 in this matrix)
Count[{{1, 2, {3, 2, 1}}, {4, 5, 6}, {3, {3}, 3}}, 3] returns 0 (there are no 3 in level1
in this matrix)
Count[{{1, 2, {3, 2, 1}}, {4, 5, 3}, {3, {3}, 3}}, 3, Infinity] returns 5 (there are five
3 in all levels in this matrix)
You can find other examples on web
http://reference.wolfram.com/mathematica/ref/Count.html
I hope helping you!
Bye
Ced
> Message du 08/09/12 09:10
> De : "Sergio Sergio"
> A : mathgroup at smc.vnet.net
> Copie =C3 :
> Objet : Count inside a matrix?
>
> Hi, does anybody know how to count elements within a matrix?
> I know how that Count works for lists, but it does not seem to work for amatrix.
> Any tips?
>
> Thanks
>
>
Une messagerie gratuite, garantie =C3 vie et des services en plus, =C3=
=A7a vous tente ?
Je cr=C3=A9e ma bo=C3=AEte mail www.laposte.net
Prev by Date:
**Re: Landau letter, Re: Mathematica as a New Approach...**
Next by Date:
**How on Earth?**
Previous by thread:
**Re: Count inside a matrix?**
Next by thread:
**Re: Count inside a matrix?**
| |