Android Question Bidimensional array lengths

riclp

New Member
Licensed User
Longtime User
Hi to all.
I want to get the two lengths of a bidimensional array.
As for example:

Dim mat(10, 5) As Float
Log(mat.Length)

It returns 10.
And if I want to get the 2nd dimension length:

Dim mat(10, 5) As Float
Log(mat(0).Length)

Return error: "Invalid number of indices"
I thought bidimensional arrays are arrays of arrays and you can get the 2nd dimension by getting an individual sub-array length.

Has anybody any suggestion without resorting to create a specific Type to store the two lengths and the array?

Thanx.
 
Yes, it works, even when the bidimensional matrix is of Float type.
Code: Copy
Sub cols(mat(,) As Float) As Int
    Dim r As Reflector
    r.Target = mat
    Dim arr1() As Float = r.GetArray(Array As Int(0))
    Return arr1.Length
End Sub
But I´m not sure about the way "GetArray" works in this case.
Is it that it returns the first "sub-array" in the bidimensional matrix by getting the first object referenced by an Int array whose first value is "0"? May asume is this the way it works?
Thank you
 
Upvote 0
Back
Top