How read a .bin file in Matlab with known block size, block number, offset_binary and nr of samples
조회 수: 6 (최근 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?
댓글 수: 0
답변 (2개)
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
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).
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!