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

Home » Public Forums » archive » HASH question
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: HASH question [message #75455 is a reply to message #75367] Mon, 07 March 2011 13:00 Go to previous messageGo to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi all,

You could also use a nested hash of hashes. For example:

h = HASH('Sirius', HASH('Color': 'blue', 'Size': 'big'), 'Betelgeuse',
HASH(...), ...)

In IDL 8.1 you will be able to index into array/list/hash elements
within a Hash (or List) using simple array indexing. So in the above
case, you would be able to do:
print, h['Sirius', 'Color']
And it will print out "blue".

This also works for assignment as well.
h['Sirius', 'Color'] = 'white'

In IDL 8.0 you could do this, but you would need to use parentheses...

The only problem with using a Hash is that the keys are not predefined
like in a named structure - you could easily miss adding a field or
spell a field incorrectly.

Just a thought.

Cheers,
Chris
ITTVIS
[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
Previous Topic: IDL 8.0 image() scaling
Next Topic: Floating illegal operand error when reach end of for loop

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

Current Time: Wed Oct 08 15:58:07 PDT 2025

Total time taken to generate the page: 0.00428 seconds