Re: Working with Indeterminate in large numerical lists
- To: mathgroup at smc.vnet.net
- Subject: [mg100237] Re: Working with Indeterminate in large numerical lists
- From: dh <dh at metrohm.com>
- Date: Thu, 28 May 2009 19:35:17 -0400 (EDT)
- References: <gvlhu1$dos$1@smc.vnet.net>
Hi, simply try negation: Select[x, ! NumberQ[#] &] Daniel pfalloon wrote: > Hi everyone, > I'm wondering about the optimal way to work with Indeterminate in > large matrices. I've been using this to replace "bad" data points that > I want to prevent from polluting calculations involving lists of data, > but I'm not sure I'm working as smartly as I could be. > > As an example, suppose I have a list of machine-precision reals and > some Indeterminate elements: > > x = RandomSample[Join[RandomReal[1, 1000], ConstantArray > [Indeterminate, 10]]; > > If I want to take only the valid entries, the best I have been able to > find is something like: > > Select[x, NumberQ] > > This seems to work reasonably well. But if I want to specifically > select the Indeterminate entries, there doesn't seem to be any > function (equivalent to, say, "isnan" from another system), so I have to > resort to something less succinct like > > Select[x, # === Indeterminate &] > > Does anyone have any suggestions on better ways to do this, or any > general tips for working with Indeterminate in this context? > > I'm particularly keen to do things in the most efficient way possible > as I'm working with rather large lists. > > Thanks, > Peter. >