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

Home » Public Forums » archive » structure references
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: structure references [message #86761 is a reply to message #86757] Sun, 01 December 2013 17:18 Go to previous messageGo to previous message
spluque is currently offline  spluque
Messages: 33
Registered: September 2013
Member
On Sun, 1 Dec 2013 11:52:25 -0800 (PST),
wlandsman <wlandsman@gmail.com> wrote:

> On Sunday, December 1, 2013 1:33:03 PM UTC-5, Sebastian Luque wrote:
>> Hi,

> In general, a structure contains elements of different types
> (e.g. string types) so

> x.(*)=20

> isn't allowed. Instead of a structure, you might look at the HASH()
> syntax which allows one to specify multiple hashes in a single call:

IDL> a = hash('a',double(0),'b',double(0), c:'string' ) a[['a','b']] =
IDL> 20.0d print,a
> c: string field a: 20.000000 b: 20.000000

Thanks, hashes do seem attractive for these purposes, however it's a
relatively new data type, so would require major changes in other parts
of the code. I might have to bite the bullet and stick to arrays, and
having code that looks like this:

FUNCTION FOO, A
return, [A*2, A^2, A^0.5]
END

;; Option 1
PRO BAR, B
x=foo(b)
x_dbl=x[0]
x_sqr=x[1]
x_sqrt=x[2]
... LOTS OF OPERATIONS WITH x_dbl, x_sqr, x_sqrt, x[*]
END
;; Option 2
PRO BAR, B
x=foo(b)
... LOTS OF OPERATIONS WITH x[0], x[1], x[2], x[*]
END

No problem, I personally prefer something like the latter but with a
little more meaningful nomenclature.

--
Seb
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Reading ERDAS IMAGINE
Next Topic: Multiple color plots, same color bar

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

Current Time: Sat Oct 11 08:17:58 PDT 2025

Total time taken to generate the page: 0.31863 seconds