comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » structures still confusing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
structures still confusing [message #49080] Mon, 12 June 2006 18:24
rother is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: procedure name quirk
Next Topic: Re: procedure name quirk

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:52:00 PDT 2025

Total time taken to generate the page: 0.20679 seconds