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

Home » Public Forums » archive » procedure with arbitrary parameter
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: procedure with arbitrary parameter [message #76404 is a reply to message #76259] Mon, 30 May 2011 13:03 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 5/30/11 12:29 PM, Evianis Cruz wrote:
> On May 30, 1:13 pm, Michael Galloy<mgal...@gmail.com> wrote:
>> On 5/30/11 10:53 AM, Evianis Cruz wrote:
>>
>>> So in my procedure call I have something like this
>>
>>> pro test, filename, var
>>
>>> restore, filename
>>> plot, var
>>
>>> end
>>
>>> var will be the name of the variable I want to plot from restoring the
>>> file. I'm thinking of giving var as a string in the procedure call. My
>>> question is how would I do this and is it possible?
>>
>> Like this?
>>
>> function mg_getsavvar, filename, varname
>> compile_opt strictarr
>>
>> restore, filename=filename
>> result = execute('plot, ' + varname)
>> end
>>
>> Mike
>> --
>> Michael Galloywww.michaelgalloy.com
>> Modern IDL, A Guide to Learning IDL:http://modernidl.idldev.com
>> Research Mathematician
>> Tech-X Corporation
>
> Thank you!! :)

No problem, but use the solution from Lajos; using EXECUTE is bad
practice unless you have to (and I forgot about SCOPE_VARFECTCH).

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL, A Guide to Learning IDL: http://modernidl.idldev.com
Research Mathematician
Tech-X Corporation
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Automatic Binsize Calculations
Next Topic: How to plot multiple cgContour plots using the same colour levels (but containing differing data)

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

Current Time: Wed Oct 08 15:44:27 PDT 2025

Total time taken to generate the page: 0.00435 seconds