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

Re: translating an array name to a string




David Williams <d.williams@qub.ac.uk> writes:

> Alex Schuster wrote:
> > 
> > David Williams wrote:
> > 
> > > Hi. This is probably a very basic IDL question, so apologies if that's
> > > the case. I'm looking for a way to translate the name of an array (e.g.
> > > "DATACUBE1") into a string that I can use in titles and/or in feedback
> > > at the prompt. I want to make my routines more user-friendly, and I hate
> > > forcing a title
> > 
> > Have a look at the OUTPUT keyword to HELP:
> > 
> 
> Vielen Dank, Alex! That was just what I needed.

Pardon me, but if you know the name of your variable already, then it
seems that you don't really have a problem.  If you know the variable
name is MOVIE, then why not hardcode that into the output string?

On the other hand, if you are in a procedure or function, it might
indeed be useful to know the name of variable at the *caller's* level.
In that case you would want to use the ROUTINE_NAMES function, which
is unfortunately undocumented.

I have documented what I and the newsgroup have discovered about this
very useful function.  You will find it here:

http://cow.physics.wisc.edu/~craigm/idl/idl.html

listed under Introspection.

Good luck!
Craig

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