structures still confusing [message #49080] |
Mon, 12 June 2006 18:24 |
rother
Messages: 9 Registered: April 2000
|
Junior Member |
|
|
Hi Gurus,
finally something, where I don't know,
if it's odd idl syntax or not...
something about structures.
FUNCTION test_struct
s = [{ m : [1L, 2L, 3L], n :1L }]
FOR i = 1L, 2L DO BEGIN
;
s = [s, { m : [1L, 2L, 3L], n : i }]
;
ENDFOR
return, s
END
this creates an array of structures:
(X). s = test_struct()
(X). help,/struct,s
** Structure <fa330>, 2 tags, length=16, data length=16, refs=1:
M LONG Array[3]
N LONG 1
(X). print, n_elements(s)
3
(X).
so far ok, I guess. but
(X). help,s.m
<Expression> LONG = Array[3, 3]
(X). print, s.m
1 2 3
1 2 3
1 2 3
(X). print, s.m[0]
1 1 1
(X). print, s.m[1]
2 2 2
(X). print, s.m[2]
3 3 3
is a *bit* confusing. isn't it?
best regards,
martin.
--
Martin Rother (rother@gfz-potsdam.de) +331 / 288-1272 Section 2.3
GeoForschungsZentrum Potsdam, Germany
|
|
|