License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
GDL
About building parametric objects with GDL.

Length/Size of one of the sub-arrays of a multi-dim array

dushyant
Enthusiast
Hi
Is there a way to get the length/size of a sub-array of a multi-dimensional array?
DIM myArray[][]
myArray[1][1] = 500
myArray[1][2] = 510
myArray[2][1] = 600
myArray[2][2] = 610
myArray[2][3] = 620
myArray[3][1] = 700
myArray[3][2] = 710
myArray[3][3] = 720
myArray[3][4] = 730
VARDIM1(myArray[1]) !gives 4, but I need the size of just myArray[1], which is 2

I tried VARDIM2(myArray[1]) also but it doesn't give the required output.
32 REPLIES 32
Podolsky
Ace
We started here (I started) the thread called Open Source GDL Project - where users can exchange GDL scripts, ideas, macros and develop new tools in open source manner.
dushyant
Enthusiast
Ah, okay.
Peter Baksa
Graphisoft
Graphisoft
I think this might help:
dict d
dim EMPTYARRAY[]

d.array[1].subarray = EMPTYARRAY
d.array[2].subarray = EMPTYARRAY

d.array[1].subarray[1] = 11
d.array[2].subarray[1] = 21
d.array[2].subarray[2] = 22


print d, vardim1(d.array[1].subarray), vardim1(d.array[2].subarray)
dushyant wrote:
In that case, multi-dim arrays might not be helpful for what I am trying to do. Thanks guys for the help.

Can dictionaries be looped through?
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!