From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Best Way To Build An Array Of Many Elements

Simple question for you LabVIEW experts: I want to build an array of many element for use in my code.  The problem is I have 20 elements I need to insert into the "Build Array Function."  This takes up much code space and is really not that clean.  I was thinking of using a For Loop and use the iteration terminal as the index for each element.  The For Loop would then use auto indexing and build this array for me.

 

Is there a more efficient way to do this?  Thanks!

0 Kudos
Message 1 of 8
(2,865 Views)

Where is this data originating from?  That might be the place to look.  If you can create the original data in a FOR loop, then your problem is gone.

 

Otherwise, just use the Build Array.  It will be the most efficient way.


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 2 of 8
(2,856 Views)

You can just wire your array of 20 elements to the wall of the loop, then select indexing mode to concatenate.

Message 3 of 8
(2,847 Views)

The data is coming from button controls on the front panel.

0 Kudos
Message 4 of 8
(2,845 Views)

You might be better off making your "button controls" and array of boolean controls.  Then it's already an array on the Block Diagram.  If this isn't an option, you could read all of the values by their control references.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 5 of 8
(2,843 Views)

Crossrulz, I was planning on handling it like this: 

 

I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?

 

BuildArray.png

 

 

 

0 Kudos
Message 6 of 8
(2,840 Views)

@hobby1 wrote:

Crossrulz, I was planning on handling it like this: 

 

I have a total of 17 element I need to build an array from.  Each case would include another element to be written to the array.  Is this the correct way to handle this?

 

BuildArray.png

 

 

 


Thats one way to do it.  Not nearly as efficient as using the Build Array, but it will work.


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 7 of 8
(2,828 Views)

@jcarmody wrote:

You might be better off making your "button controls" and array of boolean controls.  Then it's already an array on the Block Diagram.  If this isn't an option, you could read all of the values by their control references.


If you need more control over appearance than an array allows, a cluster will work too, and then you just place a small Cluster to Array node on the block diagram. Clusters offer a lot more UI flexibility than you might realize; you can make the background and border transparent so the user doesn't even see the controls are grouped together, and you can put other controls on top (but not inside) the cluster so that the cluster doesn't interfere with your overall layout.

0 Kudos
Message 8 of 8
(2,815 Views)