LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Update front panel Arrays

Solved!
Go to solution

I want to be able to dynamically update the front panel when a new array value arrives within a for loop.

 

Are there any other ways to generate auto-updating arrays ( better term?) 

 

I have a test bench that takes a minute to run a full tests but the values are generated every few seconds

 

(* see Snippet)

 

I like the implementation of Auto-Indexed* arrays and feel that it should be that simple but it doesn't update until for loop is finished.

 

I get the feeling that Feedback Loop* | Shift Register* | Local Variable* implementations are all the same with different wiring options.

 

Apparently Replace array* or using Initialize array is best for performance.

 

 

UpdatingArray.png

0 Kudos
Message 1 of 4
(894 Views)

Data flow dictates that that the outside indicator will only get data once the loop has finished. Feedback node and shift register are equivalent, a local variable not so much (much more overhead!)

 

You should use built array instead of insert into array.

 

Your "replace"  version requires that the array already has the final size, which is not guaranteed in your current design.

Message 2 of 4
(869 Views)

Thanks for the feedback as for using Build Array over Insert into Array any reasons that it is better to use or is Build Array a step of Insert into Array.

 

Roughly how much worse is using Local variables here, is it as bad if I am using them already elsewhere in code?

 

And to my initial question are there other methods to have the Front Panel arrays populate as data is generated?

0 Kudos
Message 3 of 4
(852 Views)
Solution
Accepted by topic author Onering20

Here are two reasonable alternative options (Of course you want a wait in the loop):

 

altenbach_0-1664226064315.png

 

Local variables can cause race conditions and require additional data copies in memory. Front panel objects should not be use for data storage. The wire is the variable. Front panel elements are for the user, not to shuffle data around.

 

Case in point, You write to a local variable ("replace array") in parallel to the FOR loop and there is absolutely no guarantee that the outside local variable is written before the local gets read inside the loop at the first iteration. Classic race condition!! Whatever happens first wins, but the result critically depends on the order!

 

The difference between built array and insert into array is described in my last paragraph here.

 

Message 4 of 4
(841 Views)