LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array of floating point to decimal

Here is my issue, I have data being converted in to a large array of Single Precision Floating Point Numbers and this is stored as 4 bytes. What I need to do is take every 4 bytes and convert it in to a decimal out of an array of 32 by 125 and then turn it back in to either an array or matrix. Or at least someway to interpret the data. I have included a pic of what I have being outputted and how I need to convert it along with a link to a web page that explains the process a little better. I am just not sure how to do it in lab view.

 

here is the website

http://www.jefflewis.net/XPlaneUDP_8.html

just scroll down to where it says Single Precision Floating Point Numbers and Bytes

0 Kudos
Message 1 of 11
(4,043 Views)
So is it only the second column of the data that is holding the SGL float values? What are the other columns?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 11
(4,027 Views)
i need to do it through out the entire array. Grouping every 4 values.
0 Kudos
Message 3 of 11
(4,025 Views)
Can you post a data file containing the kind of data that's in the screen shot and a listing of what you think the values are - or at least what they should be like?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 11
(4,023 Views)

A data file? The data that is going in to the vi is raw udp data that i have coming out of a simulator. The idea of this vi is just to be a graphical representation of what the data that is contained int he sim. There really isnt a way to store it. I have written a matlab code that i can input the 4 bites manually to check at times. I even tried to put it in to the labview but with no success. I am up for any suggestions that you might have to help you in any way.

0 Kudos
Message 5 of 11
(4,015 Views)
The link you provided seems to imply that you actually get an array of bytes, but the picture you have shows an array of "reals", which in LabVIEW-speak is DBL. I suspect that you actually get an array of bytes. In that case it seems to me that all you're trying to do is perform a standard IEEE-754 conversion. For this you just need to use the Type Cast function, as shown here:

Message Edited by smercurio_fc on 07-24-2007 12:18 PM

Message 6 of 11
(4,005 Views)
tried  that no luck. here is the acctual file that i am working with, if it would offer any help.
0 Kudos
Message 7 of 11
(3,991 Views)
The method I showed you is how to convert 4 bytes that represent a single-precision number to a single precision number. This is IEEE-754 format.

I'm not proficient in Matlab, so I have no clue what you're doing in that Matlab script. I do know that you shouldn't have "clc" in there, though. Perhaps you can explain in words what you're doing in that script. A LabVIEW implementation can then be provided.

I did note a couple of problems with the VI:
  • You have the UDP Close and Error Handler just "free floating" in the block diagram, not connected to anything. These should be outside the while loop so they execute when the loop ends.
  • You seem to be calling some subVI that's in the examples directory, which I could not find. I did not your VI is in 8.2.1, and I have 8.20, so I don't know if this VI was added in 8.2.1. In general, though, you do not want to directly call VIs in the example directory since you can accidentally modify them and break examples.
Message 8 of 11
(3,985 Views)
Assuming the image you posted is typical data, I created a VI to convert it to sgl precision floats. Do these values look right? See the comments on the block diagram for details on how the code works.


Mike...




Message Edited by mikeporter on 07-24-2007 02:38 PM


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 9 of 11
(3,980 Views)
Mike i tried what you made and it works. So now what is the best way to add it to my program. In the previous message i added a copy of my vi. It needs to go and connect to the data comming out of the matlab script code.
0 Kudos
Message 10 of 11
(3,967 Views)