Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
9 ratings:
 4.33 out of 5     Rate this Document

How Do I Convert A Boolean To A Double in LabVIEW?

Primary Software: LabVIEW Development Systems>>LabVIEW Base Package
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
How do I convert a Boolean to a Double?

Solution:
There are multiple methods of converting a boolean to a double. Three of these methods are:
  • Use a Case Structure with a double constant '1' for the true case and a double constant '0' for the false case.
  • Use the Select Function to select a double constant '1' for true and a double constant '0' for false.
  • Convert the boolean to a integer using the boolean to (0,1) function then convert that integer to a double using the double to precision float function.
These methods can be seen in Figure 1 below:


Figure 1:
Three methods of converting a boolean to a double.


Related Links:
LabVIEW 8.6 Help: Case Structure
LabVIEW 8.6 Help: Select Function
LabVIEW 8.6 Help: Boolean To (0,1) Function
LabVIEW 8.6 Help: To Double Precision Float Function

Attachments:
Bool_to_Double.vi




Report Date: 11/01/2004
Last Updated: 09/06/2011
Document ID: 3F0FI4Y7

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit