Home »
Public Forums »
archive »
Re: variables
Re: variables [message #6719] |
Tue, 06 August 1996 00:00 |
meron
Messages: 51 Registered: July 1995
|
Member |
|
|
In article <4u87le$ubq@netnews.upenn.edu>, gromm@red.seas.upenn.edu (Gideon Z Romm) writes:
>
> Is there any way to convert a string into a variable name?
>
> That is, let's say I created a procedure that wants a variable name and I
> want to use a scalar of the form 'some_scalar'. Is there a way that I
> can convert it into the form that variable names expect?
You can do it using the function EXECUTE. See example below:
IDL> some_scalar = 'whatever'
IDL> val = 25.
IDL> dum = execute(some_scalar + ' = ' + string(val^2 - val))
IDL> print, whatever
600.000
Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
|
|
|
Current Time: Wed Oct 08 17:42:03 PDT 2025
Total time taken to generate the page: 0.00555 seconds