06-18-2009 09:28 AM
Hi,
I have been trying to open and read a binary file composed of a main header and a stream of frames. I have set the offset in order to read only the 1st frame (i skip the frame header too) and extract all the binary information in a 2D matrix.
The same thing was done under Matlab a few years ago which works perfectly and i get different results than Matlab. I join my trial VI to extract the 2D matrix, the FileInfo.vi just reads the main header in order to get all the necessary information like the main header size, the resolution...
Frame Infos:
-resolution : 320x240
-main header size : 3472 bytes
-frame header size : 1016 bytes
-bit depth : 14 bits
-U16 is used to read the matrix of the frame (as in Matlab)
I only have the first column similar to the one with Matlab, but the others are different...
Thank you all for your help!
06-18-2009 09:30 AM
06-18-2009 09:31 AM - edited 06-18-2009 09:32 AM
Someone came across a similar problem a while ago.
I think MATLAB and LabVIEW read/write binary with different endianness (if that is a word )
LabVIEW uses big-endian to read binary, by default.
And I think MATLAB uses little-endian.
Check if this is the case, because if so, it will give you different data.
Edit : I just looked through your VI. It looks like you already gave that a shot.
06-18-2009 10:08 AM - edited 06-18-2009 10:09 AM
First of all, thank you for your answer.
And to answer, yes, this is the first thing i tried because i had the problem a while ago. But even with little endian, i get different results.
Edit: I am browsing the forum
06-18-2009 10:43 AM
Hi there
I think we need the data file and the results you're expecting (screenshot of Matlab or something like that).
Oh yes, please add the sub VI too.
06-19-2009 06:54 AM - edited 06-19-2009 07:03 AM
Hi,
I have almost the same results between Matlab and Labview now. The problem was that I didn't know exactly what I was reading with Matlab and not with Labview.
The new problem is that my resolution is 320x240 which should give a 1D array of 76800 elements, that I get with Matlab. Labview gives me the same array but only for the 22528 first elements, and only 0 after...
I think the problem comes from the byte stream type but i kept the same format (uint16)!
Edit : I tried to read the data as double 64bits (because with Matlab the reading transforms uint16 in double) but the size of the array doesn't change...Any Idea ?
Thanks!
Ps: I can upload the subVIs but the data is too heavy (30Gb)