This has worked for me, in order to make a three-dimensional array of size 3 x 100 x 100

Type TwoDArray
destZone() as Integer
end Type

Type ThreeDArray
origZone() as TwoDArray
end type

dim table() as ThreeDArray
dim i, j, numZones, numPurposes as integer

numZones = 100
numPurposes = 3

'redimension 3d array
redim table(numZones)
for i = 1 to numPurposes
redim table(i).origZone(numZones)
for j = 1 to numZones
redim table(i).origZone(j).destZone(numZones)
next
next

you can then get the value in the 2, 25, 99 cell with:

myval = table(2).origZone(25).destZone(99)

Have a happy Friday!

------------------------------------------------------------------------
Keith Miller
Principal Planner: GIS and Modeling
North Jersey Transportation Planning Authority, Inc.
One Newark Center, 17th floor
Newark, NJ 07102
973-639-8444
[EMAIL PROTECTED]

----Original Message Follows----
From: Peter Horsb�ll M�ller <[EMAIL PROTECTED]>
To: 'Jacques Paris' <[EMAIL PROTECTED]>, Peter Horsb�ll M�ller <[EMAIL PROTECTED]>, MIL <[EMAIL PROTECTED]>
Subject: RE: MI-L Mapinfo.Net ?
Date: Fri, 31 Jan 2003 14:58:41 +0100

I'm don't quite get that. Why do you make a type that only holds a single
variable as an array ?? Aren't types mostly used for defining a combination
of several variables ?

And is array not a reserved word in MapBasic ???

But anyway: Would this work ?

type trow
colJ() as float
end type

type tarray
nrow as integer
rowI() as trow
end type

Or are you not able to do this:

Dim arrTs as tarray
ReDim arrTs.rowI(12)

Well, as I mentioned in my first mail...beware !!!


Peter Horsb�ll M�ller
GIS Developer
COWI A/S - Geografisk Information & IT
Rug�rdsvej 55
DK 5000 Odense C

Tel +45 6313 5013
Direct +45 6313 5008
Mobil +45 2270 4308
Fax +45 6313 5090

Kampsax blev i juni 2002 overtaget af COWI. I forbindelse med den
igangv�rende integrationsprocess udskiftes vores Kampsax e-mail adresser med
COWI e-mail adresser.Hjemmesideadresser forbliver u�ndrede


> -----Original Message-----
> From: Jacques Paris [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 31, 2003 1:52 PM
> To: Peter Horsb�ll M�ller; MIL
> Subject: RE: MI-L Mapinfo.Net ?
>
>
> I have tried to develop that concept a little further to make
> it more like a standard x(i,j) type array and here is the way
> I have implemented it
>
> type trow
> colJ(2) as float
> end type
>
> type array
> nrow as integer
> rowI() as trow
> end type
>
> dim vrow as trow, arr as array
>
> dim i, j as smallint
>
> arr.nrow=3
> redim arr.rowI(arr.nrow)
>
> for i=1 to 3
> for j=1 to 2
> arr.rowI(i).colJ(j)=10+i*1+j*3.2
> next
> next
>
> for i =1 to 3
> for j =1 to 2
> print arr.rowI(i).colJ(j)
> next
> next
>
> You can notice that the I dimension (number of rows) can be
> dynamically redim'ed but that the J (number of columns) must
> be dim'ed directly in the type statement.
>
> Would anyone have another insight that would make that
> solution more flexible?
>
> Jacques Paris
> e-mail [EMAIL PROTECTED]
> MapBasic-MapInfo support http://www.paris-pc-gis.com
>
> -----Original Message-----
> From: Peter Horsb�ll M�ller [mailto:[EMAIL PROTECTED]]
> Sent: January 31, 2003 06:01
> To: 'Possberg, Hendrik'; Mapinfo-List (E-Mail) (E-Mail)
> Subject: RE: MI-L Mapinfo.Net ?
>
> You can allready now use "multi-dimensional" arrays in
> MapBasic as - I think
> - Michael Hannah has pointed out:
>
> Create a special type and use this for you array:
>
> Type T_3DPOINT
> fX As Float
> fY As Float
> fZ As Float
> End Type
>
> You can even use these types in other types, and when you use
> these types they can be arrays as well:
>
> Type T_3DPOLYLINE
> nNumPoints As Integer
> tpNodes() As T_3DPOINT
> End Type
>
> Dim arr3DPoints As T_3DPOINT,
> arr3DPLines As T_3DPOLYLINE
>
> But beware when doing this, the sligtest mistake might make
> MapInfo crash with no warnings...
>
> HTH,
> Peter Horsb�ll M�ller
> GIS Developer
> COWI A/S - Geografisk Information & IT
> Rug�rdsvej 55
> DK 5000 Odense C
>
> Tel +45 6313 5013
> Direct +45 6313 5008
> Mobil +45 2270 4308
> Fax +45 6313 5090
>
> Kampsax blev i juni 2002 overtaget af COWI. I forbindelse med
> den igangv�rende integrationsprocess udskiftes vores Kampsax
> e-mail adresser med COWI e-mail adresser.Hjemmesideadresser
> forbliver u�ndrede
>
>
> > -----Original Message-----
> > From: Possberg, Hendrik [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, January 31, 2003 11:08 AM
> > To: Mapinfo-List (E-Mail) (E-Mail)
> > Subject: MI-L Mapinfo.Net ?
> > Importance: High
> >
> >
> > Hello List,
> >
> > after the announcement of Mapinfo "migrating" to the .NET
> architecture
> > last year I would like to know if someone got news about
> this topic.
> > e.g. -release date? -beta?
> >
> > Few days before I wrote a question concerning the use of arrays. In
> > Mapbasic it is very annoying to have the restriction of only
> > one-dimensional arrays.The migration to .NET architecture
> would mean
> > the further restriction are given by the used programming language
> > (VB,C++,...). Multidimensional arrays would be no problem.
> > Is this right?
> >
> > Thanks in Advance.
> >
> >
> > Mit freundlichen Gr��en
> >
> > Hendrik Po�berg
> > Data & Methods
> >
> > Phone: +49-2131-10 97 51
> > mailto:[EMAIL PROTECTED]
> > __________________________________________________
> >
> > microm
> > Micromarketing-Systeme und Consult GmbH
> > Hellersbergstr. 14
> > 41460 Neuss
> > Germany
> >
> > Phone: +49-2131-10 97 01
> > Fax: +49-2131-10 97 77
> > mailto:[EMAIL PROTECTED]
> > http://www.microm-online.de
> > http://www.micromarketing.de
> > __________________________________________________
> >
> > Diese Nachricht wurde elektronisch versandt und ist daher auch ohne
> > Unterschrift rechtsg�ltig. Der Inhalt dieser E-Mail enth�lt
> > vertrauliche Informationen. Das Kopieren und die Weitergabe
> an Dritte
> > ist nicht gestattet. Sollten Sie diese E-Mail irrt�mlich von uns
> > erhalten haben, bitten wir Sie, diese zu vernichten und uns
> dar�ber zu
> > informieren. Im Voraus vielen Dank.
> >
> >
> >
> ---------------------------------------------------------------------
> > List hosting provided by Directions Magazine |
> www.directionsmag.com |
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > Message number: 5257
> >
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> Message number: 5263
>
>
>
>
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> Message number: 5267
>

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 5271


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 5276

Reply via email to