ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean Selection of Array Elements

This is my first real LabVIEW program.   I am looking for IDEAs and preferred pratices of creating programs  Attached I have a sub-vi that is called as soon at the user cliscks the start button on the main vi panel.  

 

When the user selects a particular size wire the numbers will be filled for both the Force UL and Force ISO from the "Look-UP Table".    These values are then passed on to the main vi to operate a hydrulic ram. 

 

The array "Table"  has four columns and 18 rows.   Two of the Boolean "switches" are used to select columns 0 and 1 or 2 and 3.   The other switches are used to select the rows.

 

I tried using tabs, clusters, selection boxes, etc, but everything gave me errors.  I would assume the errors are cause by my lack of expeirence in Labview.   

 

I do a lot of programming in C, C# and VB.net but having a tuff time relating to LabVIEW.  

 

What I really want is radio selection style buttons where you can only push one.      If the user clicks one and there is already a swith active it turns it on an makes the currently selected switch the active one.

 

The user is required to select the wire size then click if it is a copper or aluminum.  When both items are selected the force values are filled from the table and passed on to the main vi.   The sub-VI also closes once both selections are made.   It would be nice to have this as a menu selection but for now the program needs to be reset everytime the wire size is changed.  

 

I have taken LabVIEW Core 1 but that was a year ago and I was not able to do any real world programming until now.  I feel like I have forgotten 90% of what I have learned.   I want to use the errror clusters too but I had trouble with that and will let that pass for now.

 

David T.

 

 

 

 

 

0 Kudos
Message 1 of 11
(4,351 Views)

@David_Troike wrote:

What I really want is radio selection style buttons where you can only push one.


LabVIEW has a radiobutton control. It is a special container that can be fille with any number of booleans, only one will be true at any given time. The value is like an enum, containing the name of the selected boolean.

 

 I would strongly recommend avoiding controls with duplicate labels.

 

Everything looks overly complicated. What is all that stuff in the case structure??? The entire case structure makes no sense, because in order for it to execute, the loop must have just stopped, so the output is guaranteed to be true.

0 Kudos
Message 2 of 11
(4,343 Views)

I agree it is over complicated. The program started out as a modification of an existing program.   I had a difficult time understanding how it worked but need to make some changes to the test.

 

The concept is simple, I have to pass two variables to the main program when the user picks a wire size and type.    The user picks the wire size which is contained in the rows of the array then they pick the type.   There are only two types of wire but four columns.   The first two columns are the two variables for copper wire and the second two columns are the variables for the aluminum wire.    We are testing lug securness to the different types of wire to UL and ISO standards.   Respectifuly the first variable is the UL Force in lbs and the second variable is the ISO Force in lbs.

 

I would really appreciate any help in cleaning it up.   I have another version that has 36 buttons with the force number in lbs as the button label.  I then read the label to get the force value but it is even more complicated then the one attached here. 

 

0 Kudos
Message 3 of 11
(4,309 Views)

One additional note, I agree with the case structure.   I don't like it either.  That is one of the problems I am having is that it will not pass a variable until it goes through each button and checks to see if it is true.  

0 Kudos
Message 4 of 11
(4,307 Views)

@David_Troike wrote:

I would really appreciate any help in cleaning it up.   I have another version that has 36 buttons with the force number in lbs as the button label.  I then read the label to get the force value but it is even more complicated then the one attached here. 

 


OK, I understand the copper vs aluminum. I still don't get the full specifications. You have only 18 rows, but 30 buttons.. How do 30 buttons reduce to 16 rows? If I understand right, the row is encoded in the label.

 

I would put all 30 buttons inside a radiobutton control, then use it to index into a lookup table of rows.

 

I would also add an OK button. This way the VI will be called with the most recently used settings on the second call.

Message 5 of 11
(4,296 Views)

The other version with 36 buttons has 36 rows and 2 columns.   18 rows for both wire sizes, metric and AWG in copper and then another 18 for aluminum.  

 

And yes the row is encoded in the label of the button.  

 

I did find the radio buttons.  I also found a couple of examples on how to use them.

 

 

Thanks alenback, I will try the OK button.   That makes more sense then attempting to have it close as soon as you click the last button.  I tried using tabs to make things a little less cluttered but did not know how to ignor the label for the tabs when extracting the row number out of the label.

 

 

0 Kudos
Message 6 of 11
(4,278 Views)

Use a Radio Buttons contron from the Boolean palette.

0 Kudos
Message 7 of 11
(4,268 Views)

Have you considered a Multicolumn Listbox?  I have not read all the details of the thread or studied your VI, but it appears that this might be an option. You can set the strings to make the display read the way you want and can change it programmatically if needed (such as adding a wire size). The listbox has pop-up options which let you determine how many items can be selected.

 

Lynn

0 Kudos
Message 8 of 11
(4,259 Views)

Have considered the list box but the users what buttons.  They are using a touch screen monitor and feel this is the best way to select the options.

0 Kudos
Message 9 of 11
(4,252 Views)

Here's a quick implementation using radiobuttons (LV 2012). Maybe you can adapt it to your needs. 😄

 

 

Message 10 of 11
(4,220 Views)