Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Selecting Lists Without Null Results

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69038] Re: [mg68970] Selecting Lists Without Null Results
  • From: "Chris Chiasson" <chris at chiasson.name>
  • Date: Sun, 27 Aug 2006 01:24:21 -0400 (EDT)
  • References: <200608260603.CAA02580@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

There are so many functions in the function reference, that it can be
hard to know which one to use. That only comes with experience. In
this case, you should probably use Count or perhaps Length applied to
Cases. If this isn't close enough to what you want to do, please let
me know.

a=Array[Random[]&,{5,5}];
a[[{2,4},5]]=Null;

Length@Cases[a,x_/;MemberQ[x,Null]]

Out[3]=
2

Count[a,{___,Null,___}]

Out[4]=
2


On 8/26/06, Gregory Lypny <gregory.lypny at videotron.ca> wrote:
>         I must be doing something wrong as usual.  How come I can select
> list with elements that have the word Null in them as a result of a
> computation, but I cannot exclude them?
>
> I have an array called runsTable with 179 rows, and there are five
> rows with Null in column 14.
>
> So,
>
>         Length[Select[runsTable, #[[14]] == Null &]
>
> returns 5.
>
> But
>
>         Length[Select[runsTable, (#[[14]]¬ Null) &]]
>
> returns 0 when it should return 174, that is, 179 minus 5.
>
>         Am I using the NOT operator incorrectly?
>
>         Regards,
>
>                 Gregory
>
>


-- 
http://chris.chiasson.name/


  • Prev by Date: Numerical evaluation is Mathematica bottleneck?!
  • Next by Date: Re: General--Exponential simplifications by default
  • Previous by thread: Selecting Lists Without Null Results
  • Next by thread: Re: Selecting Lists Without Null Results