Re: Simple PRO in a loop question [message #67672] |
Fri, 14 August 2009 07:56 |
Maarten[1]
Messages: 176 Registered: November 2005
|
Senior Member |
|
|
On Aug 14, 4:37 pm, a <rmc...@gmail.com> wrote:
> Let me preface by saying I'm still getting used to IDL syntax/best
> coding.
> I have a simple main level pro that calls a lower pro in a for loop.
> If this lower pro doesn't find data, it will return before completing
> it's usual task. So I naively thought I could check the "outputs" of
> the lower pro to see if it completed or not. My problem is the 2nd
> time in the for loop the "outputs" of the lower pro are defined with
> the 1st iteration outputs, so I can't test the outputs for being
> undefined. I'm thinking in MATLAB, and need help thinking in IDL. I
> could change the pro to a function, but I really don't like outputting
> everything in a single structure.
There are several solutions to this problem. I prefer to change the
procedure to a function anyway, using the return value for a return
status, and the parameters to the function as before.
Another solution is to use Coyote's UNDEFINE, to undefine the input
variables at the end of the for-loop, and proceed as before.
A final one is to add a status keyword to the procedure, and return a
status value through this keyword.
And for Spanish inquisition-like final: call message to issue an error
message (and either use proper error handling, or just hope for the
best).
Best,
Maarten
|
|
|