Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2857

Mapping to Create Nested Loops

From Gregory Lypny <gregory.lypny@videotron.ca>
Newsgroups comp.soft-sys.math.mathematica
Subject Mapping to Create Nested Loops
Date 2011-06-01 08:32 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <is4tf2$b2l$1@smc.vnet.net> (permalink)

Show all headers | View raw


Hello everyone,

I'm trying to learn how to use pure functions and mapping to create what amounts to nested loops. 

Suppose I have a 50 x 6 array called myArray.  The third element of each row is the word red, blue, or green.  If I wanted to break down the array into three according to the value of the third element, I could do this:

Cases[myArray, {__, __, #, __, __, __}] & /@ {red, blue, green}

But what if I needed to do this for more than one array?  Suppose I had three 50 x 6 arrays as

myListOfArrays = {myArray1, myArray2, myArray3} or perhaps the arrays might be imported from files. 


Regards,

Gregory

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Mapping to Create Nested Loops Gregory Lypny <gregory.lypny@videotron.ca> - 2011-06-01 08:32 +0000

csiph-web