Read a binary file of format float
조회 수: 53 (최근 30일)
이전 댓글 표시
Hello, I have a binary file that holds a content of float array that wa written in c#. I want to read it into matlab to view that float array. I think I need to use the next command but it seems to fail:
myfloat=fread(fID,1,'float');
댓글 수: 0
답변 (2개)
Salaheddin Hosseinzadeh
2015년 6월 3일
편집: Salaheddin Hosseinzadeh
2015년 6월 3일
Hi Alon,
As a C# programmer you know that "it fails" is not enough!
BTW, sometime when I want to generate a file specially on drive C, I have to open MATLAB as an administrator! You may wanna to this as well.
댓글 수: 4
Salaheddin Hosseinzadeh
2015년 6월 3일
Dear Alon,
Just answer James questions.
When you open the file using fopen, do you get a valid File ID?
A valid file ID is an integer.
fileID = fopen('myfile.xyz')
Most importantly, pleaseee post the error message
James Tursa
2015년 6월 3일
Did you open the file first to obtain a valid fID? Are you getting an error message? (If so, please post the entire message). Are you getting garbage for myfloat? (Indicating possible endian problem, or maybe header data not accounted for, or data is not really float, etc.)
댓글 수: 10
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!