09-21-2023 02:42 AM - edited 09-21-2023 03:31 AM
Hi,
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.
Thanks.
Solved! Go to Solution.
09-21-2023 04:51 AM
In the 'other' cases the array must wire through to keep the values.
09-21-2023 07:37 AM
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.
09-21-2023 07:39 AM
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.
Thanks Yamaeda
09-21-2023 07:41 AM
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.