From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intermittent problem using "invoke node -> reinitialization to default" command to clear an array

Solved!
Go to solution
Solution
Accepted by chuck72352

chuck72352 wrote:

I use the "reinitalization to default" invoke node to clear an array after sending the data to a file. The next time the vi is called the array should appear with all elements set at the default values. However occasionally the array will not be cleared and data from the previous time the vi was called is still in the arrary, or at least it appears that way since the same data for the previous time called appear in the file  when the new values are appended to the file. New data appears okay, only data points in the array which I dont update appear with the old values. And again it's an intermittent problem. I can fix the problem for a while anyway by shutting down labview and rerunning it.  Any ideas what's going on?


As others have already stated, this code is nearly unmaintainable and cannot be degugged in any reasonable way. The main problems is probably that you are reading from indicators via local variables. Thus you have to deal with potential race conditions.

 

Please get rid of all these property nodes!

 

Here's a simple suggestion: Go to VI properties...execution and select "clear indicators on each call". It might solve some of your problems, but only touches the tip of the iceberg, of course.

Message 11 of 15
(565 Views)
I'm not sure what control that you mean. I use a series of 19 "for" loops to load data into the appended array. When you refer to control labeled '1' do you mean the local read variable? Thank you, Chuck M.
0 Kudos
Message 12 of 15
(557 Views)

Please always quote relevant parts of posts you are replying to. Is this in respose to my posts? I cannot tell.

 

There are plenty of indicators that you read via local variables to form your array. Any of those are suspect.

0 Kudos
Message 13 of 15
(556 Views)

I'm not sure what control that you mean. I use a series of 19 "for" loops to load data into the appended array. When you refer to control labeled '1' do you mean the local read variable? Thank you, Chuck M.

 

You are not using a for loop but a sequence structure when there is no sequence needed at all, just to save screen estate instead of creating a subVI for this.

 

But I mean the place upstream of the wires, where you read from all the local variables that are numbered through. The correspunding controls/indicators might not be properly initalized.

 

Felix

Message 14 of 15
(548 Views)
Thank you!
0 Kudos
Message 15 of 15
(541 Views)