05-09-2016 10:55 PM
@blessedk wrote:
1. First part of my question was confirming if there should be a Boolean control inside the event structure that Altenbach provided.
Yes, the panel close? event should have a TRUE wired to the loop termination. That seems obvous. (My picture shows the corner of a different case and just illustrated what comes after. If the loop does not stop, that code would not be reached).
@blessedk wrote:
2. Second question was to find out how to "interrupt" a program ( not stop the loop or exit the program (
And it does not have to be by stopping Subvis). For example let's say I am running a SubVi that takes 20 mins to execute and I just realized that I entered a wrong value for one of the controls to that SubVi.
I wouldn't want to wait for 20mins before entering the right value and execute the same SubVi again. -
What does the subVI do during the 20 minutes? Does the subVI show its front panel? If there is just an unconditional 20 minute wait function nothing will help. You need to design it to poll certain conditions.
For example I have an action engine that sets an interrupt flag when the <esc> key is hit. That flag is read e.g. inside the model function of nonlinear fitting, causing the model to thow error "43: interrupted by user", and thus end the fitting operation gracefully.
05-09-2016 11:00 PM
05-09-2016 11:02 PM
05-09-2016 11:09 PM
@blessedk wrote:
Altenbach,. Thanks for responding. The SubVi is actually running within that 20min period - llots of calculations with large 2D arrays.
Your description is insufficient to give advice. Is it one long worm of calculations or a looping calculation. Does it involve subVIs or flat code?
Can you show us the subVI code?
05-09-2016 11:15 PM
05-09-2016 11:20 PM
Are you sure that 20 minutes is reasonable. Could it be that your code is very inefficient?
What does it actually do? Can the problem be parallelized? Can it be split into parts?
05-09-2016 11:37 PM
05-10-2016 05:37 AM
@blessedk wrote:
I had to use nested loops even when element level computation was not required.
Use a Notifier in your inner-most loop with a timeout of 0. Then you can sent the notification telling the loops to abort.
05-10-2016 07:54 AM
05-10-2016 08:26 AM