Showing results for 
Search instead for 
Did you mean: 

Interpreting values supposedly in fixed-point format

For the sake of completion, note that the final code portion should look as follows to properly extract the dbl formatted ffirst and flast (the header information translation portion was slightly modified from yours):

Message Edited by DonRoth on 05-29-2008 07:08 AM
0 Kudos
Message 31 of 34
Yes, that looks right. I missed the point that the unused values were supposed to be DBL.

Byte Position        Format        Name
3                           char             fexp
4                           DWORD     fnpts
8                           double           ffirst
16                         double          flast

Using a cluster of correctly ordered elements, each in the correct representation is a nice shortcut, useful if all the values are adjacent.

Maybe you even want to start at zero with a string of 24 elements and add three more U8 (or one U16 and one U8) at the beginning of the cluster.

It is possible that there is e.g. information on the file version so you can validate that you're dealing with a galactic file and not some other random file type.


LabVIEW Champion. It all comes together in GCentral GCentral
Message 32 of 34
You might also want to wire the error cluster across the unflatten nodes. This way it won't try to do anything if the file reading fails.

LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 33 of 34

@altenbach wrote:

I don't quite get where the "exponent" comes from. Is this the same for the entire datafile?

Anyway, to get the data, you need to unflatten it from string as little endian I32 and then divide by 2^32 and multiply by the exponent.

File position 4 has a 4 byte number that seems to represent the data size in # of points (6453 in your case). The data starts at 544.

There is a lot of other information in the file, I am sure the exponent is somewhere. You need the full file specification.

Here's a quick attempt at reading the file assuming an exponent of 1. See if it get's you any closer. Good luck! 🙂

(the code is very crude. Typically  you would want to take the subset with length 4x6456 before unflattening the data.)

Can't you juse Type cast to FXP instead of dividing? And to get the Exponent change FXP setting accordingly, so if it's 3 (2^3) the FXP format is 3.28?


G# - Award winning reference based OOP for LV, for free! ADDQ VIPM Now on GitHub
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
0 Kudos
Message 34 of 34