필터 지우기
필터 지우기

Open .bin file contains words and floating numbers

조회 수: 9 (최근 30일)
Dimani4
Dimani4 2024년 3월 4일
댓글: Dimani4 2024년 3월 5일
Hi people,
I have some .bin file and trying to open it but what I got is not what it should be. The file contains words and floating numbers. Please see attached two files: one .bin file and one .txt file. I just check in .txt file what should be in file after I open the same .bin file in matlab.
Thank you.
I try:
datar=fopen(FD_file_path,'r');
x = fread(datar,'int16');
x = fread(datar, inf, 'float32');

채택된 답변

Steven Lord
Steven Lord 2024년 3월 4일
Without knowing the format of the file, it's going to be effectively impossible to interpret the data you read from the file.
Which of the 12 programs on this list created your .bin file? Or was it created by some other program in its own format?
If you don't know the format of the file, your .txt file may be able to serve as a Rosetta Stone to help you reverse engineer the format.
You probably want to use *int16 and *float32 as the precision inputs to fread so fread reads them in as int16 or single data and returns them as int16 and single arrays respectively, rather than returning them as double arrays.
Depending on the endianness of the data you may need to use swapbytes as well.
  댓글 수: 1
Dimani4
Dimani4 2024년 3월 5일
Hi Steven,
File Management
  • Unicode support: international file and folder names
  • open data files: read directly from binary or plain-text files
  • save data file: binary, plain-text formats for exporting data (e.g., to spreadsheet)
  • list data file
  • convert to text files: for exporting multiple data files
  • text file format
  • print present data
  • print multiple data files
  • print setup
Thank you.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by