Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Importing .bin file and doing Time Domain Analysis

조회 수: 1 (최근 30일)
Tahajib Abdur Rahman
Tahajib Abdur Rahman 2020년 9월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
Is it possible to import a .bin file to Matlab? How? Do I need to make any format conversion of .bin file before importing it?
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 9월 10일
.bin is not a standard file format. .bin is an extension programmers use for any binary data that only works with their particular program. You would need details on how that particular program stores data inside the file.

답변 (1개)

Ayush Gupta
Ayush Gupta 2020년 9월 16일
A bin file can be imported in MATLAB using fread function. Suppose we have a bin file named input.bin, refer to the following code:
fileID = fopen('input.bin');
A = fread(fileID)
The documentation of fread and examples on how to use it, refer here.
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 9월 16일
Note that for files,
A = fread(fileID)
is the same as
A = fread(fileID, [inf 1], 'uint8=>double')
So I would typically recommend
A = fread(fileID, [1 inf], '*uint8');
This would give you an uninterpreted stream of bytes.
... but .bin files are rarely intended to be just streams of bytes. They usually have a format with some kind of header, and then data that is often not uint8. You would need to find the documentation for that particular application to know how to interpret the bytes -- there is no standard at all for ".bin" files.
That said... there are some files that are intended to be portable between applications that use .bin file extension. unofficial standards for that kind of data. At the moment we do not know enough to know whether this is one of those cases.
Tahajib Abdur Rahman
Tahajib Abdur Rahman 2020년 9월 16일
Thanks Walter. Appreciate it.

이 질문은 마감되었습니다.

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by