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,523 Views)
Solution
Accepted by topic author 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,513 Views)

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

 

Amanda

0 Kudos
Message 3 of 4
(2,505 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,503 Views)