[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strings as variables?




brbojkov@netscape.net (B. R. Bojkov) writes:

> Hello All,
> 
> I am writing a "general" HDF extraction subroutine using IDL 5.4 and I
> am stuck... 
> 
> Let me explain:
> 
> 1. I read from an HDF file the names (strings) representing the
> different data arrays found in the given file (this can change from
> file to file).
> 
> 2. I successfully extract the different data arrays found in the file
> and assign them to their matching dataset names using the EXECUTE
> command.
> 
> 3. What I want to do next is pass the actual data variables (with
> their appropriate name from point 2.)  to another subroutine (I want
> to pass the actual variables, not the string containing their names).
> 
> Am I missing something big?   Any suggestions?

You probably aren't missing something big.  The answer is to also call
the subroutines mentioned in number 3 by using the EXECUTE statement
as well.  This sounds kind of kludgey, but that's probably because
steps 1 and 2 are a bit kludgey as well.  I'm wondering, why does the
name of the variable make a difference?  Couldn't you just call it
DATA in your procedure?

If the number of variables is itself variable, then this is a time to
use pointers, or more specifically arrays of pointers.

Craig

-- 
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------