Re: Matrices and Conditional Statements
- To: mathgroup at smc.vnet.net
- Subject: [mg61440] Re: [mg61405] Matrices and Conditional Statements
- From: ggroup at sarj.ca
- Date: Wed, 19 Oct 2005 02:16:28 -0400 (EDT)
- References: <200510180644.CAA11233@smc.vnet.net>
- Reply-to: ggroup at sarj.ca
- Sender: owner-wri-mathgroup at wolfram.com
On Tuesday, October 18, 2005 at 02:44 GMT -0400, Gregory Lypny wrote:
> If I have an n x m array called X, how can I create another
> array, Y, whose rows are those rows in X whose 8th column contains
> the word "red" and whose 11th column is a number greater than 9?
(* Generate some Random data *)
list1 = Table[
Flatten[
{Table[Random[], {7}],
If[2*Random[] > 1, "red", "green"],
Table[Random[], {2}],
Random[]*18}], {100}];
(* Filter the data *)
list2 = Select[
list1,
StringMatchQ[#[[8]], "red", IgnoreCase -> True] && #[[11]] > 9 &]
- References:
- Matrices and Conditional Statements
- From: Gregory Lypny <gregory.lypny@videotron.ca>
- Matrices and Conditional Statements