LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Results different between Labview and matlab

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!

 

 

0 Kudos
Message 1 of 6
(2,494 Views)
If you need more info, just let me know
0 Kudos
Message 2 of 6
(2,491 Views)

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 Smiley Very Happy )

 

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.

Message Edited by Cory K on 06-18-2009 09:32 AM
Cory K
0 Kudos
Message 3 of 6
(2,490 Views)

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

Message Edited by christophe69000 on 06-18-2009 10:09 AM
0 Kudos
Message 4 of 6
(2,472 Views)

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.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 6
(2,458 Views)

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)

Message Edited by christophe69000 on 06-19-2009 07:03 AM
0 Kudos
Message 6 of 6
(2,425 Views)