Manipulating parts of a multi-dimensional array

Jacques Hausser jacques.hausser at unil.ch
Sun Jun 16 18:39:36 EDT 2013


I'm not sure to understand your question correctly.

if your array has four "first level" elements: myArray["a"]    myArray["b"]    myArray["c"]    myArray["d"] 
and that e.g. myArray["c"] has three "second level" elements myArray["c"]["x"]    myArray["c"]["y"]    myArray["c"]["z"]
which in turn contain several "third level" elements, e.g. myArray["c"]["y"][1]   myArray["c"]["y"][2]   myArray["c"]["y"][3]

you can perfectly well <   put myArray["c"]["y"] into NewArray   > , which will have elements NewArray[1]  NewArray [2]   NewArray[3]

NewArray[2] and myArray["c"]["y"][2] will have the same content. And after changing these contents (you can even replace them by other arrays) you can do the reverse

put newArray into myArray["c"]["y"]

oh, I didn't see that you got answers already - Colin's says the same thing more concisely - well I send this one nevertheless. To answer your question rather than to read your answer is such an exceptional situation I'll not miss it ;-)

Jacques



Le 16 juin 2013 à 21:26, J. Landman Gay <jacque at hyperactivesw.com> a écrit :

> I have a big array with lots of dimensions. Sometimes I need to work with a "sub-dimension" only. For example:
> 
> array[a][b][c][d]
> 
> Each of those elements contains many other elements:
> 
> [c][x][y][z]
> 
> 
> which each contain more elements:
> 
> [c][x][1][2][3]
> 
> Suppose I only want to work with [c][x] and all its sub-dimensions. Is there an efficient way to extract that into its own array without looping through all the [c] keys?
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

******************************************
Prof. Jacques Hausser
Department of Ecology and Evolution
Biophore / Sorge
University of Lausanne
CH 1015 Lausanne
please use my private address:
6 route de Burtigny
CH-1269 Bassins
tel: 	++ 41 22 366 19 40
mobile:	++ 41 79 757 05 24
E-Mail:	jacques.hausser at unil.ch
*******************************************





More information about the use-livecode mailing list