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: 

how i convert boolean to string ?

which function do it ?
 
thanks 🙂
0 Kudos
Message 1 of 10
(49,437 Views)
 

There is no standard way of converting a boolean to a string, so there is no function to do this (a "True" boolean string can be "1", "-1", "Yes", "T", "True", etc.). You can do this by using a case structure or the Select function from the comparison palette (insert a boolean and output whichever string you want). You can convert it to a variant or to a number and then to a string or you can type cast it directly to a string. In short, it depends on what string you want, but the easiest way is by using the Select function.

This is really a rather basic question. To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here, here, here, here and here are a few you can start with and here are some tutorial videos. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
0 Kudos
Message 2 of 10
(49,428 Views)
If you want true/false output use attached vi
LV 2011, Win7
Message 3 of 10
(49,429 Views)
Use "Format into string"
LV 2011, Win7
Message 4 of 10
(49,419 Views)

This will send you "TRUE" or "FALSE" strings ... if you need to convert it to "1" or "0" strings (or any other strings you want) then use a simple case structure.

simple.png

0 Kudos
Message 5 of 10
(36,757 Views)

Hi,

 

have a look at this

 

screen.png

-
Amit
CLAD
Message 6 of 10
(36,732 Views)
Format into string will satisfy you to get string value of a Boolean (TRUE /FALSE)------
Provide format string as %s
input 1 as T /F (*Boolean)
output will be (TRUE/FALSE)
Message 7 of 10
(36,718 Views)
Continuation of previous post

If the expected value is (0/1) for (False /True)
then provide format string as %d

0 Kudos
Message 8 of 10
(36,698 Views)

@amitwadje wrote:

Hi,

 

have a look at this

 

screen.png

!0.pngavoids those dreaded BD ConstantsSmiley Wink

 


"Should be" isn't "Is" -Jay
Message 9 of 10
(36,610 Views)

@bogdan.ciobanu wrote:

This will send you "TRUE" or "FALSE" strings ... if you need to convert it to "1" or "0" strings (or any other strings you want) then use a simple case structure.

simple.png


Phew.  Good thing he has an answer now after agonizing through 9 years of slience on this thread.

 

Now, if only there were about 5 different ways to do this easier.

Message 10 of 10
(36,496 Views)