LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Better way to index an array for display

Solved!
Go to solution

I frequently do something like this for indicators on a panel, as you can see the block diagram gets messy and it takes up a lot of space.

Array.PNG

There has to be a better way.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 7
(2,850 Views)
  • Use an array indicator?
  • You seem to have repetitive groups, so you could reshape it into a 2D array for display.
  • Place all indicators inside a transparent cluster and then use "array to cluster"
  • Format the data into a table and skip numeric indicators entirely
  • ...
Message 2 of 7
(2,840 Views)

The indicators are gauges in a tabbed interface, one tab for each device under test.

 

I really do not like the look of an array of gauges, besides all of the array elements have to be identical and we need different scales on each.

 

  • Place all indicators inside a transparent cluster and then use "array to cluser

This I will have to think about...

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 7
(2,833 Views)

Use the value of the tab control and array subset. Basically get a subset of your array from 5*<tabindex> with a length of 5, and then wire those 5 up to your gauges on the front panel. Don't actually use the tab control to switch screens. And at that, you might just use an enum to select which set of gauges you want. Depending on the timing of your program you may want to cache the entire array in memory (shift register, local, something) and use an event structure to handle value changes of your selector.

 

If its important to have other data on each tab besides what you've shown here, I'd do the array->cluster conversion on a reshaped array (1x25 array->5x5 array->5x5element cluster)

0 Kudos
Message 4 of 7
(2,793 Views)

Re: "messy and it takes up a lot of space"...

The attached VI tries to improve the "messy" array indexing with a reusable sub-VI.

Unfortunately, individual control terminals are still present.

 

If you like this approach, but it doesn't work because the GUI employs nested tab-controls, the sub-VI can be modified to handle that.

Download All
0 Kudos
Message 5 of 7
(2,784 Views)

Yeah go with array subset.  Break up the array into 6 arrays, one for each group.  Or you can use decimate if you want to get the one signal from each group that represents the same signal.  Then when displaying you have have an array, or a cluster for each tab.

 

There's also options using control references, getting them by name can make things simpler in the code.  But be sure and leave lots of comments stating references are being found dynamcially otherwise the next developer maybe confused.

0 Kudos
Message 6 of 7
(2,737 Views)
Solution
Accepted by topic author RTSLVU

You could also use auto-indexing with a case structure to have a cleaner diagram.

MultipleIndicators.png

Message 7 of 7
(2,723 Views)