08-25-2014 09:54 AM
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!
08-25-2014 10:09 AM
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.
08-25-2014 10:17 AM
You can just wire your array of 20 elements to the wall of the loop, then select indexing mode to concatenate.
08-25-2014 10:18 AM
The data is coming from button controls on the front panel.
08-25-2014 10:20 AM - edited 08-25-2014 10:21 AM
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.
08-25-2014 10:23 AM - edited 08-25-2014 10:24 AM
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?
08-25-2014 10:56 AM
@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?
Thats one way to do it. Not nearly as efficient as using the Build Array, but it will work.
08-25-2014 12:56 PM
@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.