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

Home » Public Forums » archive » Re: array of structure in IDL 4.0.1 ???
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: array of structure in IDL 4.0.1 ??? [message #7135] Fri, 27 September 1996 00:00
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
On 26 Sep 1996, Hendrik Roepcke wrote:
> i want to use a predefined stucture to make an array...
> like: dummy = record(10).name
>
> is that possible ?? how to programm it?
> rec = {structname,name: "John Doe",tel:5551234 }
> record= make_array(count,/{structname}
> or is there a workaround???

Here are two ways to do it:

1 Using make_array():
First define your structure by defining a scalar.
e.g., rec = {structname,name: "John Doe",tel:5551234}
(You could also use an anonymous structure scalar.)
Then do recs=make_array(N,val=rec), where N is the number of elements you
want in your array of structures. (Of course, you don't have to stick
to a 1D array.)

2 Using replicate()
Set up your structure scalar "rec" as in (1), then do recs=replicate(rec,N).

Peter Mason
[Message index]
 
Read Message
Previous Topic: PV-Wave CONTOUR question?
Next Topic: idl can not read TIFF image

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

Current Time: Fri Oct 10 14:52:55 PDT 2025

Total time taken to generate the page: 0.48221 seconds