Re: extracting elements from multi-dimensional arrays

• To: mathgroup at smc.vnet.net
• Subject: [mg61300] Re: extracting elements from multi-dimensional arrays
• From: "Scout" <mathem at tica.org>
• Date: Fri, 14 Oct 2005 22:22:30 -0400 (EDT)
• References: <dio1v0\$t01\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```<contact at dantimatter.com> ha scritto nel messaggio
news:dio1v0\$t01\$1 at smc.vnet.net...
> Hello all,
>
> I have an array of the form:
>
> list={{a1,b1,c1},{a2,b2,c2}...}
>
> I'd like to get rid of elements of list based on criteria that apply to
> the a's, b's and c's separately.  For example, I'd like to keep the
> elements of list that have the following properties:
>
> m < a < n
> p < b < q
>
> I know there's an easy way to do this, but I can't figure it out.  Any
> suggestions?
>
> Thanks!
> dan
>
You can try this:
Select[list, (m<#[[1]]<n) && (p<#[[2]]<q)&]

For example:
In[1]:= l={{1,2,3},{5,4,3},{1,1,1}};
{m,n,p,q}={1,10,3,10};

In[3]:= Select[l,(m<#[[1]]<n) && (p<#[[2]]<q)&]
Out[3]= {{5,4,3}}

~Scout~

```

• Prev by Date: Re: changing the size of the numbers on x-axes
• Next by Date: Re: changing the size of the numbers on x-axes
• Previous by thread: extracting elements from multi-dimensional arrays
• Next by thread: Re: extracting elements from multi-dimensional arrays