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

Home » Public Forums » archive » Name of arrays
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: Name of arrays [message #79329 is a reply to message #79269] Tue, 21 February 2012 06:49 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Feb 21, 9:35 am, Israel Rodriguez Hermelo <israelherm...@gmail.com>
wrote:
> On Feb 21, 2:36 pm, David Fanning <n...@idlcoyote.com> wrote:
>
>
>
>
>
>
>
>
>
>> Israel Rodriguez Hermelo writes:
>>> First of all, I want to thank you all of you for your suggestions.
>>> Second, just say that all this months, days and temperatures was just
>>> an example of what I want to do, so I need a general way to proceed.
>>> Third, I'm running IDL v7, so the solutions for IDL v8 don't work for
>>> me.
>
>>> So I'm trying to learn how to use structures, but they are a bit
>>> confusing to me and the information I have obtained from google is not
>>> helping too much. I would appreciate any example or link to a webpage
>>> showing how to use structures. Thanks in advance!
>
>> Structures!? You mean pointers, right? You need
>> flexibility and structures are, well, just about
>> the least flexible solution of all time. Are you
>> sure you mean structures?
>
>> Cheers,
>
>> David
>
>> --
>> David Fanning, Ph.D.
>> Fanning Software Consulting, Inc.
>> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
>> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
>
> hehe yes, I was trying to do it with structures but I was already
> thinking that structures are not flexible enough. I'll try with
> pointers then. I'll let you know how it goes.
>

No, structures are easy. You can add as many elements as you want and
they can be any size that you want.

; First you create a dummy structure, or add some overall "metadata"
information if you want.
my_struct = {file_date:'2012-01-03'} ;; Whatever you want

; Then add as many data points as you want.
my_struct = create_struct(my_struct, TEMPERATURE+MONTH(0), fltarr(28))
my_struct = create_struct(my_struct, TEMPERATURE+MONTH(1), fltarr(30))
...
my_struct = create_struct(my_struct, TEMPERATURE+MONTH(11),
fltarr(30))

Pointers introduce their own overhead of allocating, managing and de-
allocating them. Structures are totally extensible and have basically
no mental overhead.

Later on, you can retrieve the contents with TAG_NAMES(), and the
"structure array" notation my_struct.(N).

Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: GRIB Webinar
Next Topic: Re: new graphics error message [_IDLITCONTAINER::SETPROPERTY]

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

Current Time: Wed Oct 08 18:14:58 PDT 2025

Total time taken to generate the page: 0.00485 seconds