From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

How to convert data while maintaining binary values

Solved!
Go to solution

Hi all,

 

I am having issues representing data in floating point format.

 

Here is an example:

 

DataConversionBD.jpg

The code above yields the following results:

 

DataConversionFP.jpg

 

Every value displayed is as expected except for single precision float. That bit array, converted to float, should be 33.5:

 

bitconv.jpg

 

It appears that LabVIEW retains the decimal value of the int and converts that to float rather than the bit string, although I wasn't able to verify that for sure because I don't know how to see the bit string used for a float without converting it to int first.

 

How can I modify this code to generate the actual float value (33.5) of the bit string rather than the decimal value of the int represented in float form?

 

Thank you,

 

Amanda

0 Kudos
Message 1 of 4
(2,520 Views)
Solution
Accepted by AmandaBacala

Instead of looking for an answer on the Conversion sub-palette, look at the "Data Manipulation" palette where you will find the Type cast.

 

Wire a single precision float to the top input and give that a try.

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 4
(2,510 Views)

Yes! That is exactly what I was looking for. And you were quick! Thank you 🙂

 

Amanda

0 Kudos
Message 3 of 4
(2,502 Views)

@AmandaBacala wrote:

Yes! That is exactly what I was looking for. And you were quick! Thank you 🙂

 

Amanda


When you do something for 20 years...

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 4
(2,500 Views)