X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 20 Feb 2009 11:58 AM by  anon
Passing Values...
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
20 Feb 2009 11:58 AM
    I have to rountinely read in a substantial amount of data (~60 parameters, each an array of ~1000 values) and then plot various subsets of it, fit curves, etc.  Right now, every plotting or fitting routine I generate has the same ~200 lines copied and pasted into it to handle this input and subset defining.  It's a pain when the format of my dataset is modified and I try to update my results, I have to hunt though all my programs to make the same teaks to the input routine.  I'd like to write a procedure that handles all my input, so that I can simply insert an input command into new procedures and then manipulate the data from there.  For example, I'd like to have a procedure "input_everything" so that I could write: pro make_a_plot input_everything plot, the_stuff, the_other_stuff oplot, more_things end Ideally, "input_everything" would read in all my data, define various subsets, and then return all the new subarrays it has made out to procedure make_a_plot.  I know how to do the reading and subset defining, it's the sending the values back out again I can't get.  "Stop" sends me back to interactive mode, but I want to keep runnning the outer procedure.  "Return" wipes out all the contents of the arrays input_everything made.  How do I get a procedure to send ~60 variables out to its parent routine?

    Deleted User



    New Member


    Posts:
    New Member


    --
    10 Mar 2009 05:29 PM
    You'll want to do something like the code below. When you call pass_test2 from pass_test1, pass_test2 will define var=42 and it is passed back out to the main procedure via the var=var keyword that you have defined. Run this code in IDL to see what I mean. The print statements show that before pass_test2 is called, var is undefined and that after it is called, var is defined as 42:   pro pass_test2, var=var     var = 42 end pro pass_test1     print, 'Before:'     help, var     pass_test2, var=var     print, 'After:'     help, var     print, var end  
    You are not authorized to post a reply.