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: 

Using a table as a control for increasing, holding and decreasing values

Solved!
Go to solution

Hello, I am looking for advice on how to create a system by using a table as a control. I made a VI that starts from a value of zero and increments up to a maximum value in a user-defined steps, then decrements back to zero.

 

I need to create a similar system that uses a table to hold its inputs. Basically there are 3 columns: column 1 holds a value from which to start incrementing, column 2 holds the goal value and column 3 holds the time in which the goal value must be reached. 

 

I have attached my VI as well as screenshots of the system I want to recreate. Can anyone give me input on where I can start and how I can make the table-controlled system?

Download All
0 Kudos
Message 1 of 9
(1,234 Views)

Hi Hobo,

 

I recommend a MCLB (multicolumn listbox) to present your data to the user instead of a table.

The user can easily select rows by clicking them…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(1,224 Views)

A table is just a 2D array of strings cosmetically suitable to preset to the user. You are dealing with numeric entries and I assume all the user does is select one of the rows (i.e. NOT modifying any of the values directly). As has been suggested, a multicolumn listbox is all you need. Keep the data in a numeric 2D array and use the listbox (in a listbox, the selected row is the "value!) to undex into your 2D array to get the relevant values for the run. (you can trigger just by selecting or you could trigger when a row is double-clicked, for example. The possibilities are endless.

 

Your snippet deals with one row, I assume, so none of the orange values are supposed to change during the run and their terminals belong before the loop.

increment_snippet.png

 

I have the nagging feeling that your "boolean gymnastics" could be dramatically simplified. Have you tried? 😄 (There is also a primitive for <=0). Shouldn't that shift register be initialized?

0 Kudos
Message 3 of 9
(1,192 Views)

@altenbach wrote:

I have the nagging feeling that your "boolean gymnastics" could be dramatically simplified. 


I think this is equivalent (but much easier to read and debug!)

 

altenbach_0-1653408216659.png

 

Or even:

 

altenbach_2-1653408619764.png

 

Please verify correct operation and tweak as needed. 😄

 

 

 

Message 4 of 9
(1,180 Views)

Thanks for the tip. I read up everything I could on multicolumn listboxes, but could not figure out one thing - can I use individual cells as controls? Or is the listbox only for displaying data?

0 Kudos
Message 5 of 9
(1,150 Views)

Thanks for the tip altenbach, it is indeed easier to debug with your solution. Do you happen to also know if I can use a multicolumn listbox as a control? What I want to do is use each individual cell in the listbox as an input for a calculation.

0 Kudos
Message 6 of 9
(1,148 Views)

Hi Hobo,

 


@InfamousHobo wrote:

Do you happen to also know if I can use a multicolumn listbox as a control? What I want to do is use each individual cell in the listbox as an input for a calculation.


You can use the MCLB as a control - but it's value is the row [number] selected by the user!

The "individual cells" are values you keep in a 2D array "in the background" (aka wire/shift register). THe user selects a row and you can use the row number to index your elements from that 2D array…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 9
(1,141 Views)

Thank you for the input. I don't quite understand what you mean though hahah. Could you please show me an example of your explanation?

0 Kudos
Message 8 of 9
(1,126 Views)
Solution
Accepted by InfamousHobo

Hi Hobo,

 


@InfamousHobo wrote:

Could you please show me an example of your explanation?


See this:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 9
(1,113 Views)