LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slider Control With Array Based Values

Solved!
Go to solution

Hi All,

 

I'm trying to find a way of assigning values to a control slider based on an array acquire via interpolation.

The end game is to try and use the slider to change between values in the array and give the corresponding index value from another array with the same size.

 

I've attached some snips for clarification.

 

Many thanks

Download All
0 Kudos
Message 1 of 9
(3,773 Views)
Solution
Accepted by topic author ChangoMutney

Hi Chango, you can set it up in the properties of the slider, or by property nodes. You'll want to use property nodes if your array can change. What you care about is the maximum and minimum of the scale (which you can get from Array Max & Min) as well as the data entry increment (which you can get from Array[1]-Array[0]. Then to make it "snap" to the allowed value you can set the response to increment outside of value to coerce (to nearest in this case).

 

capture.png

Message 2 of 9
(3,736 Views)
Solution
Accepted by topic author ChangoMutney

Take your array of values, convert to strings, use those for text labels of the slider.

sld.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 3 of 9
(3,732 Views)

That's a great idea from Paul, and gets you the index for free. If you want the slider to snap between allowed values, you will still have to set the allowed increment to 1 and coerce.

0 Kudos
Message 4 of 9
(3,728 Views)

Thank you both for your replies. 

I seem to be having trouble inputting the string format into the TextLabel property node.

I've attached a picture to try and clarify again.

 

Could it be that I've somehow got to change the output to an input? If so, how would I do that?

Thanks for your help, I really appreciate it. I'm relatively new to LabVIEW.

 

Many Thanks,

Chango

0 Kudos
Message 5 of 9
(3,705 Views)

Yep, right-click it and select "change to write".

Message 6 of 9
(3,698 Views)

Perfect, thank you very much.

0 Kudos
Message 7 of 9
(3,694 Views)

I've been racking my brain over what I'm doing wrong here, I'm really not sure. 

I keep getting an error every time I try and run the VI

Download All
0 Kudos
Message 8 of 9
(3,676 Views)

I've been racking my brain over what I'm doing wrong here, I'm really not sure. 

I keep getting an error every time I try and run the VI, I've attached the error and my block diagram.

 

Thanks again,

Chango

Download All
0 Kudos
Message 9 of 9
(3,675 Views)