LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing values from one subVI to another

Hi all,
 
I have a main VI with 2 options from it. The idea is the user runs the first subVI and obtains a value, then goes back to the main VI and runs the second subVI which uses the value previously obtained.
 
I found an ideal example of what I want to achieve that ships with Labview called NewEventHandler.vi but when I tried to apply it to my code I couldn't get it to work. The problem occurs when the value obtained from the first subVI is transfered to the main VI - it comes up as NaN.
 
I've attached the files so if anyone can spot what I'm doing wrong that would be a great help. The main VIs are called NewEventHandler.vi and OPTIONS SCREEN.vi respectively.
 
Many thanks,
 
Ian
Download All
0 Kudos
Message 1 of 3
(2,649 Views)

In your stop event, you have the defaults for the exit tunnels. It is these empty arrays that are being further processed and returned. The easiest fix is to simply put the indicators/curve fitting/etc. functions inside the event case and not pass anything outside the event. You could also use shift registers.

You might want to think about moving the entire 'find mass' subVI out of the event structure. It kind of defeats the purpose of user events when you can't click a button while you wait for the subVI to finish.

Message 2 of 3
(2,644 Views)

Cheers Dennis - once I figured out which event you were talking about it made perfect sense 🙂

Thanks again,

Ian

0 Kudos
Message 3 of 3
(2,624 Views)