MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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 &]


  • Prev by Date: Re: Function, Command, Operator, Object...etc.
  • Next by Date: Re: Matrices and Conditional Statements
  • Previous by thread: Matrices and Conditional Statements
  • Next by thread: Re: Matrices and Conditional Statements