update variable in structure [message #66952] |
Tue, 16 June 2009 09:07 |
M. Suklitsch
Messages: 12 Registered: August 2008
|
Junior Member |
|
|
Hi everybody!
Today I have a question regarding the update of variables within a
structure, which does not work as I would expect.
Say we have a very simple program:
===============
PRO update_value, input
input = input MOD 5
END
===============
[In reality, this subroutine/program does some more sophisticated
things, but this is sufficient to prove my point. ;-) ]
Okay, now we call this routine with a variable holding an integer
value.
IDL> my_value = 8
IDL> update_value, my_value
IDL> help, my_value
MY_VALUE INT = 3
So far, so good. Now we do exactly the same, but this time the
variable is embedded in a structure:
IDL> my_struct = {my_value:8}
IDL> update_value, my_value
IDL> help, my_struct, /STRUC
** Structure <8220044>, 1 tags, length=2, data length=2, refs=1:
MY_VALUE INT 8
And now the rather simple question: how come this doesn't work?
Normally IDL is eager to overwrite variables of any kind. On some
occasions, I've seen it overwriting the "parental" variable of a
duplicated one. And more important: is there a way to get the above
thing working?
Maybe important, maybe not: I'm working with IDL 7.0 and have tried it
on Solaris and Linux.
Best regards,
Martin
|
|
|