Reading file in binary format (double 64 pecision)
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to read a binary file (the attached one) with double 64 precision. Basically it is 64*1024 long, and contains intensity values (non-negative). I know I should use fread as such:
fid = fopen('sample_1_trace')
input1 = fread(fid,'double');
However, in the results obtained I am getting negative values. Can you please confirm whether I am reading the file the right way? Because if that is the case, the error may be in the file itself.
Note: I tried to attached the file, but I could not due to format restriction.
채택된 답변
추가 답변 (1개)
Wilson A N
2017년 1월 16일
I tried writing a binary file with both negative and positive values. Then I tried reading the binary file using fread just as you have mentioned. I got the values correctly as I have written to the binary file.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!