LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build array element labeling

Hello,
 
  I am using the build array function to make a large boolean array. How can I have the element positions labeled so that I can easily determine what bit in the array I am connecting to?
 
Regards,
 
Kaspar
Regards,


Kaspar
0 Kudos
Message 1 of 7
(3,491 Views)
Every element in an array is of the same type and has the same properties, except value. You could make an array of clusters where the cluster consists of a boolean and a string. The string then becomes the label for the boolean in that cluster. Another option is a second array of strings arranged beside the array of booleans. You have to do some customizing to get the elements of the two arrays to have the same size. You also need to do some behind the scenes manipulation of indices so both arrays display the same elements simultaneously.

Lynn
Message 2 of 7
(3,486 Views)
Do you mean labeling on the front panel array control or on the block diagram code?
Jarrod S.
National Instruments
0 Kudos
Message 3 of 7
(3,472 Views)

Here's a screenshot showing an easy way to accomplish the cluster approach that Lynn described...should be fairly straightforward to do if you already have your boolean array.

-D

Message Edited by Darren on 05-23-2007 01:40 PM

Message 4 of 7
(3,466 Views)
I am refering to labeling on the block diagram
Regards,


Kaspar
0 Kudos
Message 5 of 7
(3,449 Views)
You didn't mention that in your problem statement.  Also, you mentioned you're using Build Array.  Are you interested in knowing the terminal position on the Build Array that you're wiring to?  There is currently no way to do that, as they all have a name of "element" when you hover over the Build Array with a tip strip.  How many values are you wiring to your Build Array, anyway?  If there are so many that you can't keep them straight without labels, perhaps there's a more elegant way to deal with the code?
 
If not, though, perhaps you could include a decoration on the diagram separating every 5th element that could help you more easily determine what position you're at with the build array:
 
 
-D

Message Edited by Darren on 05-23-2007 03:09 PM

Message 6 of 7
(3,438 Views)
Ring controls and enums are good ways to bind numeric values with human-readable text. You could create a ring control and give it string labels that correspond to the bits in your array. Each string label in the ring then corresponds to a number, which is the actual index in your array. For instance:

Ring Value      Label
0                     Bit 1
1                     Bit 2

Then on your block diagram you use a ring constant of this ring instead of a numeric constant to index out values from your array. It makes your code much more readable.

P.S. This won't help you if you're just using Build Array. This method only helps when using Index Array. Instead of using Build Array, however, you can pre-allocate your array and use my method with Replace Array Subset.


Message Edited by Jarrod S. on 05-23-2007 03:13 PM

Jarrod S.
National Instruments
0 Kudos
Message 7 of 7
(3,431 Views)