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

Home » Public Forums » archive » Evaluate a string as a variable name
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Evaluate a string as a variable name [message #70731] Mon, 03 May 2010 15:02
laurel is currently offline  laurel
Messages: 3
Registered: June 2005
Junior Member
I have a structure that has multiple name/value pairs, and I want to
extract the value that corresponds with the name. However, I am only
passing in a string of the name, not the structure.name, so I need a
way to combine the two such that I am evaluating the string. It might
be easier to explain with an example:

***
;create a simple structure
struct={name1:9, $
name2:5, $
name3:1}

;variable that matches the part of the structure I want
x='name2'

;create a string that if it were a variable, it would be part of the
structure, 'struct.name2'
y='struct'+'.'+x

;want to have z=5, or z=struct.name2 rather than z='struct.name2'
;Here evaluate stands in for whatever I would do to make that happen
z=evaluate(y)
***

Does anyone know how to make z equal to the value corresponding with
struct.name2?
[Message index]
 
Read Message
Previous Topic: OR
Next Topic: Orthorectifying Quickbird scenes with RPC files

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

Current Time: Fri Oct 10 00:08:57 PDT 2025

Total time taken to generate the page: 1.03703 seconds