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

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?

 

Thank you.

Chuck

0 Kudos
Message 1 of 15
(1,492 Views)

Can you post some code/picture of code?

 

It is hard to guess what is going wrong.

 

Felix

0 Kudos
Message 2 of 15
(1,489 Views)

Hi Chuck,

 

what happens when you replace that invoke node with wiring an empty array constant to a local of that array control?

 

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 3 of 15
(1,485 Views)

The array is labeled "appended array" and is in case 23. The invoke node is in case -1.  

 

i"m a beginner and don't really understand what you're asking, but I'll try and figure it out.

0 Kudos
Message 4 of 15
(1,482 Views)
I guess that you mean local variable? So you're suggesting that I create a local variable and attach an empty array constant if I understand you.
0 Kudos
Message 5 of 15
(1,480 Views)

Hi Chuck,

 

yes, that's what I suggested...

 

I can't open your vi right now, but are you sure your case "-1" is really executed?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 6 of 15
(1,475 Views)
I opened it and quickly closed it. It hurt my eyes. You can use a local to clear a specific control but why would you use separate Invoke Nodes for each and every control? You can init all of them with a single one.
0 Kudos
Message 7 of 15
(1,472 Views)

Yes, I'm sure case -1 is executed because I have regular variables that are reset there. I only have the intermittent problem with the array. I dont really understand your suggestion. I know how to create a local variable and attached an empty array constant, but dont know what you mean be array control. The array I'm talking about only exists on the block diagram.

 

Thanks,

Chuck M.

0 Kudos
Message 8 of 15
(1,466 Views)

A lot of this code should be done different, just for the reason that it is difficult to find such problems. I would suggest you browse examples about state machines to see some 'best practices'.

 

But I guess I found the source of your error for now: I checked the control labled '1' which is used to build your appended array. Here I didn't find any initialization code or invoke node. Maybe that's it?

 

Felix

0 Kudos
Message 9 of 15
(1,464 Views)

I'm not sure what you mean. For each individual variable I use the invoke node and for the array I use one invoke node. I dont understand what you mean by "use a local to clear a specific control". The array I'm trying to clear isn't really a control, as it exists only on the block diagram. How would I go about clearing the array with a local. Where is the control that you're referring to?

 

Thanks,
Chuck M.

0 Kudos
Message 10 of 15
(1,462 Views)