Re: Using Select with arrays? (Relative newbie)

• To: mathgroup at smc.vnet.net
• Subject: [mg54243] Re: Using Select with arrays? (Relative newbie)
• From: David Bailey <dave at Remove_Thisdbailey.co.uk>
• Date: Mon, 14 Feb 2005 21:50:36 -0500 (EST)
• References: <cup5ip\$dsr\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

Select selects using a boolean function, Cases (which is what you want
here) selects by pattern:

c=5;
d=6;
data={
{1,1,"string1",c,d} ,
{1,2,"string2",c,d} ,
{1,3,"string3",c,d} ,
{1,4,"string4",c,d} ,
{2,1,"string1",c,d} ,
{2,2,"string2",c,d} ,
{3,1,"string3",c,d},
{4,1,"string2",c,d} ,
{4,2,"string4",c,d}};

Cases[data, {1, _Integer, _String, _Integer, _Integer}]

{{1, 1, string1, 5, 4}, {1, 2, string2, 5, 4}, {
1, 3, string3, 5, 4}, {1, 4, string4, 5, 4}}

Note - as written, your strings were not quoted and there were some
commas missing - I guess just typos. Also, c and d required values -
otherwise the pattern _Integer will not match. If this is a problem,
just use the pattern _ in those positions, and it will match anything.

David Bailey
dbaileyconsultancy.co.uk

```

• Prev by Date: Re: rules and lists
• Next by Date: Re: rules and lists
• Previous by thread: Re: Re: Re: Using Select with arrays? (Relative newbie)
• Next by thread: Re: Using Select with arrays? (Relative newbie)