LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array Clearing Itself After Stopping/Starting

Solved!
Go to solution

Hi Everyone,

 

I have an array called "Channel_Array". 

It is an array of clusters. The clusters contain about 8 bits of numeric information.

 

When the stop button, then the start button, is hit on my vi, all of the array data in just this array is cleared.

This array's 3 local variable references are all reads only.

The array gets loaded during an 'initilize' function that only runs when a toggle switch is set on, the switch causes the initilization sequence to run once then turn itself off. It recieves data from 1 sub vi, then passes by reference to a 2nd sub vi which does some read-writes.

 However as I said, the initilize switch is off at all times during normal operation. Turning the vi off then on again is causing the array to clear itself to all 0s.

 

Any suggestions? Is there some setting that would cause this array to default itself to 0 when the vi is started?

Thank you. 

0 Kudos
Message 1 of 6
(3,451 Views)
When the array has whatever values you want to keep there, right click the array and click:
Data Operations >> Set Current Value Default
Cory K
0 Kudos
Message 2 of 6
(3,448 Views)

The default values isnt the problem, plus I initilize them when we start the program the first time.

The problem is values are being lost somehow between the "Stop" and "Run" buttons on the VI. 

All other values in the VI hold themselves between stop and start, except this array. I'm just curious if there's some goofy setting that does it, or if maybe the subVI referencing causes the array to act differently, or maybe I just bugged it. I'd rather not delete and remake the array because it will mess with the subVI references.

 

0 Kudos
Message 3 of 6
(3,441 Views)

If you post your VI, it would help in trying to figure out the problem.

 

Is it possible you didn't wire the array wire through all the cases in your case structure?  Or have a case structure where the another case has the tunnel set to use default if unwired?

Message 4 of 6
(3,438 Views)
Solution
Accepted by topic author mantone2

I think your are only telling us the tip of the iceberg. I thing you have a uncommon use for the word "reference" and "referencing", etc. A reference has an exact meaning in LabVIEW, bit I don't think you are talking about control references and VI references here.

 

Also, you use of local variables can blur the distinction between controls and indicators. Could it be that this array is the only indicator and you have the execution option (VI properties) set to "clear indicators when called"?

 

Please attach your code so we can play with it. 🙂

Message 5 of 6
(3,433 Views)

Thank you that's exactly what was happening. I tend to keep everything as controls, and I must have changed this to an indicator the other day.

Thanks everyone. 

0 Kudos
Message 6 of 6
(3,428 Views)