LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I combine arrays and front panel design?

Solved!
Go to solution

Hello.

I'm trying to make a flexible test program, where the user in runtime can specify the amount of action points he/she wants to have, and the program should then adjust the front panel accordingly.

 

In this case I've added eight action points, with various components (indicator, parameters, comment fields etc).

 

Firstly, I want to be able to add or remove action points (could solve this having a maximum number placed, and disabling the ones not used, or just by making unused action points invisible).

Secondly, I want to be able to manipulate these using array functions or similar (using an index to a control in a group of controls, rather than accessing the control directly).

 

Clipboard-1.png

 

A method I've used before is this one:

 

Clipboard-2.png

 

Here I'm creating an array of references to the LED controls.  This way I can just output the reference to the wanted control, and use a Property Node to set or read the value.  This method works, but it's very time consuming to set up.

 

I'm wondering if there's a better, more elegant and less time consuming way to do this.  Anybody got any ideas? 🙂

 

The reason I'm not using an array, is that all the controls get smooshed together on the frontpanel, and I don't have the freedom to place the controls where I want them.

 

Thanks for any help!

 

Message 1 of 9
(2,889 Views)

use a cluster...

Example_VI.png

0 Kudos
Message 2 of 9
(2,886 Views)

Thank you.  How do I access the controls in the cluster using an index?

0 Kudos
Message 3 of 9
(2,884 Views)

@OysteinJohnsen wrote:

Thank you.  How do I access the controls in the cluster using an index?


Array index then Unbundle By Name


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 9
(2,880 Views)

@apok wrote:

use a cluster...


I tried your suggestion.  But I fail to see how this is easier to code, as you still have to make a reference to each control, and you now also have to make an input cluster for the Bundle By Name function.  Also, how can you in this case read or write one of the bools with an index, and not chosing it manually in the Unbundle By Name function in the block diagram?

 

 

 

0 Kudos
Message 5 of 9
(2,833 Views)

@crossrulz wrote:

@OysteinJohnsen wrote:

Thank you.  How do I access the controls in the cluster using an index?


Array index then Unbundle By Name


How do I do this?  Can you please show an example?

0 Kudos
Message 6 of 9
(2,830 Views)

What about an array of clusters?

 

arraycluster.PNG

 

You can pass the array of clusters to a for loop, autoindexed, and unbundle by name on the Active element. Any element of the array whose cluster has Active = False could then be discarded. The array is then as flexible as you wish it to be in terms fo size.

---
CLA
Message 7 of 9
(2,824 Views)
Solution
Accepted by topic author OysteinJohnsen

Here's a quick example of how I would do this.  I used Autoindexing of a FOR loop to do the indexing of the array.  I can then use Unbundle By Name to get the elements I want.  Since it looks like the LEDs are to tell the user what step is active, I also updated that using a local variable of the array, Bundle By Name, and Replace Array Subset.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(2,817 Views)

Thank you for all ideas!  I ended up with using an array of clusters, as suggested.  And it works perfectly (well, more or less)! 🙂  But I'm using an event loop with a "timestamp and trigger" system instead of a FOR loop, to avoid locking the whole program down during each run.

0 Kudos
Message 9 of 9
(2,749 Views)