.mat file to bin file

조회 수: 3 (최근 30일)
sumit kumar
sumit kumar 2012년 10월 8일
답변: Walter Roberson 2024년 12월 20일
Hi, I have recorded some WCDMA data using gnuradio and USRP which is in .bin format with 32bit floating point (both I and Q). I used octave to read that bin file and converted to .mat file so that it be imported into MATLAB. I did some signal processing on that data. Now I want that .mat file to be converted back to .bin file. I searched but couldn't succeed. Any pointers ?
Sumit
  댓글 수: 1
Walter Roberson
Walter Roberson 2024년 12월 17일
".bin" as a file extension is not at all standardized. It can be used for any binary file format. We cannot advise on how to create .bin files without documentation on the exact file format.

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

답변 (2개)

Walter Roberson
Walter Roberson 2024년 12월 20일
Probably something like
filename = 'OUTPUTFILENAMEGOESHERE.bin';
[fid, msg] = fopen(filename, 'w');
if fid < 0; error('Failed to open "%" because "%s"', filename, msg); end
IQ = single([reshape(I, 1, []), reshape(Q, 1, [])]);
fwrite(fid, IQ, 'float32');
fclose(fid);

Pratik
Pratik 2024년 12월 17일
Hi Sumit,
To convert .mat file to bin file, dec2bin function can be used. Please refer to the following MATLAB Answers post which discusses about the same process:
  댓글 수: 1
Walter Roberson
Walter Roberson 2024년 12월 17일
dec2bin is absolutely completely unrelated to the task of building .bin files.

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

카테고리

Help CenterFile Exchange에서 Other Formats에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by