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?
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 で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!