Well, you simply need to know the details (datatype, byte order, size headers, etc.), but you are not providing any. To get specific help, show us how you are writing to file in LabVIEW, maybe even attach a simple example.
What is the datatype? Do you write scalars or arrays? LabVIEW is always big-endian so make sure to read it that way in matlab.
I've added an example. It's badly written but should give the jest of what I'm doing.
In this file, I keep generating a 1D integer vector of 512 in length (normally the length is a lot bigger and I'm getting data faster than I can save it on the hard drive) in one while loop while my second loop is save it to the hard drive.
Datatype: 1D vector integer
Is this a LabVIEW or Matlab question?
You are writing to a flat binary structure in the example you have shown. In Matlab you should use fopen, then fread, and the other elementary commands in Matlab.
LabVIEW is always big-endian so make sure to read it that way in matlab.
Last I checked, Matlab defaults to Little Endian. Luckily, you can set the Endianness with the Write Binary File.
I think I understand how to read the file with Matlab. What I'm missing is how Labview save the files. I understand the median part. What I don't understand is, for each of my saved values in my vector, let's say the first 12, how many bit do I have to read? How many bits in the file correspond to one value?
Is it always the same for an integer number in Labview or will it depend on the number itself. Will 12 take as many bits as 1253?
A sixteen bit number, I16, U16 takes 16 bits, I32, U32, 32 bits, sgl precision 32 bits, double precision 64 bits.
Will 12 take as many bits as 1253?
The only time these will be different if you were writing ascii characters, each character is 8 bits.
Thank you for your hel, finally understood and I'll post it here for someone else.
-The data was saved as u16 which I discored by adding an indicator and looking at the tag on the indicator.
-After that, here is the Matlab code for opening it:
fid = fopen('savedData.dat','r','b'); %r for reading and b for big endian
mydata = fread(fid, 'ubit16', 'b'); %b for big endian again and ubit16 is the format of the data
-Then mydata gave me a double precision vector cointaining the same data I had on Labview.