X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Oct 2006 09:09 AM by  anon
May I access a variable via a string type variable?
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
09 Oct 2006 09:09 AM
    For example, I have a string type variable temp = "Frame1" May I use this variable to access the variable Frame1? Thank you.

    Deleted User



    New Member


    Posts:
    New Member


    --
    09 Oct 2006 09:09 AM
    Variable names stored as strings can only be used in the following IDL Functions: EXECUTE SCOPE_VARFETCH Either of these functions may provide the functionality you are looking for. EXECUTE takes a string argument like: executeStatement = "Frame1 = " + strtrim(myCurrentFrame, 2) success = EXECUTE(executeStatement) The above would give you the ability to set a variable named Frame1 in the current scope to a new value. Maybe the below syntax will interest you even more: targetFrame = SCOPE_VARFETCH('Frame1') That would allow you to access the data stored by variable 'Frame1' in the current scope. SCOPE_VARFETCH also has a LEVEL keyword that allows programs to access variables that are in scopes "above" the routine in current focus. James Jones
    You are not authorized to post a reply.