LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary data format in labview 8.6 and up

Solved!
Go to solution

I write a binary file in LV8.6 of an array of clusters in which each cluster has many data types in it including more arrays and clusters. I want to read this data in a MatLab program but nothing is reading correctly.  It also seems like there was change between after labview 7.x where the type defs were written in 16 bit before are now in 32 bit. and I can't find any documentation on how the binary write function stores data for complex data types.  Any search for documentation on the labview website just brings up hundreds of irrelevant hits.  I try to read the binary file in matlab and i don't see any of the expected numbers coming out.

 

Anyone have a link to where i can get the specs for LV >= 8.6 binary formats.  Or the full info on flatten-to-string for the newer versions of labview.

 

thanks. 

0 Kudos
Message 1 of 6
(3,405 Views)

Maybe this KB helps:

 

Writing Binary Files with LabVIEW That Can Be Read by Other Applications -> http://digital.ni.com/public.nsf/allkb/97332426D63630EE862565070049FFBB?OpenDocument

Christian

0 Kudos
Message 2 of 6
(3,354 Views)
I think the OP want to know how a cluster is organized. Or more precise. If I wire a cluster to the "flatten to string" function, how will my output look like. I have seen this on the NI site before. But I i can not find it.


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 3 of 6
(3,351 Views)

evren wrote:

It also seems like there was change between after labview 7.x where the type defs were written in 16 bit before are now in 32 bit.


I have no idea what this means. A typedef isn't written out anywhere. A typedef is just a definition of a structure.

 

Your most likely problem is that of endianness (Matlab uses little endian, LabVIEW uses big endian), or that you are not taking into account that when you write out an array the default is to prepend the array size before writing out the array.

0 Kudos
Message 4 of 6
(3,337 Views)

this is all part of the question. does labview write the type def out so that anyone can read it - meaning the structure of the original array of clusters can be recreated without knowing the data type.  Obviously the size of an array has to be written before the array data.  In what format is the size written?  Is it a 16 bit or a 32 bit unsigned int?  Is it something else?  The first 16 bits i read in the file comes out 0000 in hex.  But the array of clusters i saved is not zero in length.  If I read 32 bit uints then the numbers get crazy after the first two blocks.  

 

i am reading in big endian in matlab.  as far as i know LV writes in big endian by default I have not changed that default in the write program.

 

thanks. 

0 Kudos
Message 5 of 6
(3,323 Views)
Solution
Accepted by evren

The format of the flattened data is documented in the LabVIEW Help. From the Contents tab expand Fundamentals -> How LabVIEW Stores Data in Memory -> Concepts -> Flattened Data.

 

The Flatten to String function only saves the data, not the structure. You must be thinking of the Type Descriptors. Yes, this changed in LabVIEW 8. In LV 7 they were 16-bit. In LV 8 they're 32-bit. This is also documented in the LabVIEW Help.  Fundamentals -> How LabVIEW Stores Data in Memory -> Concepts -> Type Descriptors.

0 Kudos
Message 6 of 6
(3,304 Views)