LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting DBL control to control string of different format

Solved!
Go to solution

In the below control, the "Channels" control is an input of double and the "Task Channels" is an input of string and also in a different format to communicate with the VIs I'm using. I am trying to eliminate having two separate controls for this input as they are linearly related besides a formatting issue. Is there a way to convert it in the following format below:

 

DBL     STRING

   4    =     0:3

   3    =     0:2

   2    =     0:1

   1    =      0

 

The part that seems like it might be complicated with what I am doing is that a value of 1 eliminates the colon and second digit.

 

Thank you for any help.

 

Capture.PNG

0 Kudos
Message 1 of 4
(718 Views)

A simple lookup table would probably be the easiest.  You have an array of the string values and you use Index Array with the Channels value as the index.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(690 Views)
Solution
Accepted by topic author tareyes

Try this

 

BertMcMahan_0-1694793847470.png

 

(note, you probably want to handle the case where the user passes a "0" to the Channels input)

 

Message 3 of 4
(682 Views)

Appreciate the help, this is perfect for my input condition. In response to the control for a "0" input, it is not necessary because the VI for the DAC I'm using will throw an error with no channels selected and fail to run anyway. 

 

0 Kudos
Message 4 of 4
(672 Views)