Showing results for 
Search instead for 
Did you mean: 

keep array values between Case switching

Go to solution



I've been scouring the LabView examples and forums to try and find an answer to this problem I am having, it may be me not using the right terms to search with:


I want to populate an array as the program goes through several cases but every time the case changes, the array goes to empty again. I think this must be because the array is discarded once the case is changed, but I want to keep it. I have tried declaring the array outside the case structure, with new ones inside their respective case and using Build Array to add them together but it never works. 

Is this just something which cannot be done?


In case you are wondering why I want it this way, I am creating test logs which I want to be on one line per unit test so it is easy to analyse the data later.


EDIT: For a bit more clarity on the app - it sets a bank of fans to a low speed -> reads the speed back -> sets to high speed -> reads the speed back. The reading back speeds is where the speed is added to the array and this is where I want to keep appending the previous array, not wipe and start again. 


0 Kudos
Message 1 of 5
Accepted by topic author trebor89

In the 'other' cases the array must wire through to keep the values.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Message 2 of 5

In addition to what Yamaeda's comment that the value must be wired out in all cases.


1. It is a bad habit to enable Use Default If Unwire option. The default value is usually zero or empty array.



2. Since you are using the template for state machine, you should use the provided cluster to store all data. Use bundle and unbundle to read write to and from the shift register cluster.



Message 3 of 5

Due to your prompt to look at linking the array through each case I then looked at the diagram as a whole - I didn't have a shift register at the input/output of the state machine which meant it wasn't carried out all the way - I thought you could only have 1 shift register on a data line. Now carrying the data through a full run as intended.



Message 4 of 5

Thanks ZYOng for the additional information - I was going to look at the data bus once I had everything up and running to see how I should be using that.


0 Kudos
Message 5 of 5