Re: evaluate string as a variable

From: guillaume mauger <gmauger_at_nyahnyahspammersnyahnyah>
Date: Wed, 19 Sep 2007 14:04:32 -0700

Sorry - that was somewhat vague.

To clarify:

Basically, my question is about executing a string as an ncl command.
I'd like to pass a string variable to a procedure, and have it execute a
command that incorporates that string.

I clarified the examples below, which show two different (hypothetical)
ways that I thought this could be achieved:

>> Example 1:
>>
>> bb = "aa" ;; NOTE: *NOT* converting aa to string, just creating
>> ;; a string variable = to the string "aa"
>> aa = new(3,"integer")
>>
>> With these variables, I would like to be able to
>> do something akin to the following:
>>
>> print(all(ismissing($bb$)))
>>
>> ...and have it return the result evaluated for the
>> variable 'aa': instead of passing the string to
>> 'ismissing', the string is interpreted as a variable
>> name.
>>
>>
>> Exampe 2:
>>
>> eval( "print(all(ismissing(" + bb + ")))" )
>>
>> here, the entire string is evaluated and executed
>> as an ncl command.
>>

thanks again,
guillaume

-- 
guillaume mauger
http://ieng9.ucsd.edu/~gmauger/
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 19 2007 - 15:04:32 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 24 2007 - 11:44:39 MDT