필터 지우기
필터 지우기

How read a .bin file in Matlab with known block size, block number, offset_binary and nr of samples

조회 수: 4 (최근 30일)
0
I have a .bin file I'd like to read in Matlab. It contains an ASCII header with this information:
block size is 64; Block numbers is 24; offset binary is 1984; samples is 171170;
First I used fid=fopen(file) and A=fread(fid), however the size of A is a total different number than the "samples". Then I tried to use A = fread(fileID, sizeA, precision, skip, machineformat) However, I don't know the correct size, I don't know what value type to choose for precision (I think I understand it has to be 64 bits, but don't know if it's signed or unsigned or so). Also I don't know if I should use the offset binary in and samples in the formula. With everything I tried I got weird numbers. I did email the supplier of the device the file comes from, however he told me there is no Matlab knowledge there, so they could not tell me how the file is composed. Any ideas?

답변 (2개)

Maria Perdomo
Maria Perdomo 2014년 2월 14일
Hi,
I had a binary file, and could oppen with the next function:
I just downloaded the function, saved it in the same directory of my file and executed it:
>> ReadLeCroyBinaryWaveform('Name.bin')
And it created the variable with the data of my binary file.

Image Analyst
Image Analyst 2014년 2월 14일
Is it an image or just some 1D list of numbers? Do you know what the data should look like if it is read properly? I'd press the manufacturer some more. How can they not know the format of their own file? That's absurd. They may not know MATLAB but they should know what the bytes in the file mean. Otherwise you'll just have to guess until you find something that works (which will be easier for an image than 1D data because it will look sheared or duplicated and you can adjust your parameters in a systematic fashion until it looks right).
  댓글 수: 1
Marit
Marit 2014년 2월 17일
Thanks for your answer. The file is a 1D list of numbers. The data looks like the bright red line in the figures:
It is the diameter of a blood vessel in the head and it should be numbers between 40 and 70 (mm).
I contacted the manufacturer (Germany) and they forwarded my question to the Dutch supplier, which I already contacted and told me they didn't know how the information in the ASCII header (and so the .bin file) is composed. There must be somebody who knows, so indeed I'll have to press the manufacturer some more.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by