arrays of arrays?

Martin Buschkühl martin.buschkuehl at psy.unibe.ch
Wed Jan 17 20:21:46 UTC 2007


Hi,

maybe you can solve your problem with the use of multi-dimensional 
arrays. You have to declare such an array as follows:

dim array(3,3)

In this case, a variable (i.e. a two dimensional array) containing a 4 x 
4 matrix (with a base index of 0) is declared. You are then able to 
access each item in this matrix by defining its coordinates with the two 
numbers in the brackets. You can find further information about 
multi-dimensional arrays on this website:

http://en.wikipedia.org/wiki/Array#Multi-dimensional_arrays

Note, that the function "randomizearray" does not work with 
multi-dimensional arrays.

Best,

Martin.


Katherine Sledge Moore schrieb:
> Is it possible in E-basic to make an array of arrays? 
>
> So let's say you had the following: 
> Dim array1(2) as Integer
> Dim array2(2) as Integer
> Dim array3(2) as Integer
>
> Array1(0) = 0
> Array1(1) = 1
> Array1(2) = 2
>
> Array2(0) = 3
> Array2(1) = 4
> Array2(2) = 5
>
> Array3(0) = 6
> Array3(1) = 7
> Array3(2) = 8
>
>
> Can you then say:
>
> Dim allarray(2) as array
>
> Allarray(0) = array1
> Allarray(1) = array2
> Allarray(2) = array3
>
> If I wanted to get to the 0th item in the 2nd array could I then say:
>  x = allarray(2(0))? Is there some other way of doing it?
>
>
>
>   

-- 
lic. phil. Martin Buschkühl
University of Bern
Department of Psychology
Division of Experimental Psychology and Neuropsychology
Muesmattstrasse 45
3012 Bern
Switzerland

phone	+41 (0)31 631 47 34
fax	+41 (0)31 631 82 12

http://www.apn.psy.unibe.ch



More information about the Eprime mailing list