Re: procedure in case statement [message #82142 is a reply to message #82049] |
Mon, 19 November 2012 07:42   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
Here's what I am assuming:
1) you have a separate file called "proc_one.pro" (all lower case) that
contains the "proc_one" procedure.
2) you have a separate file called "proc_two.pro" (all lower case) that
contains the "proc_two" procedure.
Based on that, why can't you just do:
read,rot,prompt='rot via proc one or two? (1 or 2)'
case rot of
1: proc_one,a,b,c
2: proc_two,d,e,f
endcase
Note I use an integer selector rather than typing out the actual name of
the procedure required (after a couple of tests, all that typing would
drive me nuts).
Once you get this working, then you might want to start to get fancier
using CALL_PROCEDURE, or EXECUTE, or similar.
cheers,
paulv
On 11/19/12 09:06, hannah_ue@web.de wrote:
> Am Montag, 19. November 2012 14:36:19 UTC+1 schrieb hann...@web.de:
>> hi there,
>>
>> i'm relatively new to IDL programming. is there any way to run a
>> PROcedure in a CASE statement? i want to ask myself via READ which
>> PROcedure i want to use.
>>
>> thanks for your help!
>>
>> ich
>
> hm... i get the same error. what i have is: 2 procedures i wrote
> whichwork. instead of using two different files for each procedure, i want
> one file where i can choose the one procedure i like. lets call them
> proc_one,a,b,c and proc_two,d,e,f. i tried it like the following:
>
> read,rot,prompt='rot via proc one or two? (proc_one,proc_two)'
> case rot of
> 'proc_one': call_procedure,proc_one,a,b,c
> 'proc_two': call_procedure,porch_two,d,e,f
> endcase
>
> maybe this is not very clever but i have no idea how to do it in another way
|
|
|