Re: position of matrix elements for intervals
- To: mathgroup at smc.vnet.net
- Subject: [mg78446] Re: [mg78426] position of matrix elements for intervals
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Mon, 2 Jul 2007 06:45:05 -0400 (EDT)
- References: <3257815.1183292494672.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
data = {{1, 1.`, 0.9999999932328848`}, {1.`, 0.9985849617864345`,
3.7570598417296495`*^-108}, {0.9999999999267634`,
4.0643593704937925`*^-207, 0}};
positions = Position[data, x_ /; .99 <= x]
{{1, 1}, {1, 2}, {1, 3}, {2, 1}, {2, 2}, {3, 1}}
Cases[data, x_ /; .99 <= x, Infinity]
{1, 1., 1., 1., 0.998585, 1.}
Extract[data, positions]
{1, 1., 1., 1., 0.998585, 1.}
Bobby
On Sun, 01 Jul 2007 06:44:48 -0500, kristoph <kristophs.post at web.de> wrote:
> Hi,
>
> Assume you have the following table:
>
> {{1, 1.`, 0.9999999932328848`}, {1.`, 0.9985849617864345`,
> 3.7570598417296495`*^-108}, {0.9999999999267634`,
> 4.0643593704937925`*^-207, 0}}
>
> I would like the position of all the elements >= 0.99. Or the position
> of all the elements of [0.4, 0.9] which in the above table does make a
> lot of sense.
> I'm familiar with Position[...,.] but since I look for reals of an
> interval I would kindly ask for help.
>
> Thanks a lot,
> Kristoph
>
>
>
--
DrMajorBob at bigfoot.com