Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Matrices and Conditional Statements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61457] Re: Matrices and Conditional Statements
  • From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
  • Date: Wed, 19 Oct 2005 02:17:13 -0400 (EDT)
  • References: <dj26om$bcr$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Use a pattern to filter the matrix:

p={_,_,_,_,_,_,_,"red",_,_,_?(#>9&),___};

You then have:

MatchQ[{1,2,3,4,5,6,7,"red",9,10,9.01},p]

     True

but:

MatchQ[{1,2,3,4,5,6,7,"red",9,10,8.99},p]

     False

So this should do what you want:

Cases[X, p]

Steve Luttrell

"Gregory Lypny" <gregory.lypny at videotron.ca> wrote in message 
news:dj26om$bcr$1 at smc.vnet.net...
> Hello Everyone,
>
>     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?
>
>     Regards,
>
>         Greg
> 



  • Prev by Date: Re: Matrices and Conditional Statements
  • Next by Date: Re: Help with a function to return the 'age' of itself
  • Previous by thread: Re: Matrices and Conditional Statements
  • Next by thread: Help with a function to return the 'age' of itself