Thanks is that i was seeking.


-----Mensaje original-----
De: Jorge Gil [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 14 de abril de 2005 11:49
Para: S. Esteban Rodr�guez; Mapinfo-L
Asunto: RE: MI-L bidimensional variable


The straight answer is no.
But taking on from Peter's suggestions you can define a 2D array type with
one linear array member, create an array of the 2D array type, and set the
size of the first to be i and the other j.
To make it clearer here's an example:

Type _2DArray
        v() As Float
End Type

Declare Sub Main
Declare Sub Build2DArray( array() As _2DArray, i_size As Integer, j_size As
Integer )

Sub Main
        Dim V() As _2DArray
        Dim i, j, m, n As Integer

        i=2
        j=2

        'create the array
        Call Build2DArray(V,i,j)

        'update the array values
        V(1).v(1) = 1.5
        V(1).v(2) = 3.2
        V(2).v(1) = 4.5
        V(2).v(2) = 5.5

        'display results
        For m = 1 To i
                For n = 1 To j
                        Print V(m).v(n)
                Next
        Next

        'clear the array
        ReDim V(0)

End Sub

Sub Build2DArray( array() As _2DArray, i_size As Integer, j_size As
Integer )
        Dim m As Integer

        ReDim array(i_size)
        For m = 1 To i_size
                ReDim array(m).v(j_size)
        Next
End Sub


I admit that it's a hack and manipulating this type isn't the most elegant
thing in the world, but it works...

Jorge

__________________________________

Jorge Gil
Simulation Developer

SPACE SYNTAX
__________________________________



-----Original Message-----
From: S. Esteban Rodr�guez [mailto:[EMAIL PROTECTED]
Sent: 13 April 2005 18:00
To: Mapinfo-L
Subject: RE: MI-L bidimensional variable


we want to use a bidimensional (two dimensions) variable something thus
V(i,j) where V have the i dimension and the j dimension .

Thanks for the responses.



-----Mensaje original-----
De: Bill Thoen [mailto:[EMAIL PROTECTED]
Enviado el: mi�rcoles, 13 de abril de 2005 18:29
Para: S. Esteban Rodr�guez
CC: Mapinfo-L
Asunto: Re: MI-L bidimensional variable


On Wed, 13 Apr 2005, S. Esteban Rodr�guez wrote:

> is possible declare a array bidimensional variable in MapBasic??

You can use an array of user-defined types, or do you mean a
multidimensioal array?



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



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


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

Reply via email to