fread + double-precision 8-byte floating point + precision
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi All,
I want to use fread to read my binary file. The data type are "double-precision 8-byte floating point". When I put 8*double as precision, it gives me weird values that I am sure it is wrong. How can I put both float + double in precision?
Thanks a lot
댓글 수: 0
채택된 답변
Geoff Hayes
2015년 10월 30일
Farz - if the data type (within your file) is double-precision 8-byte floating point, then why not just use double or float64 as either should correspond to 8-byte floating point numbers? Check out fread input argument precision and use fread as (for example)
A = fread(fileID,[3 3],'double');
댓글 수: 3
Geoff Hayes
2015년 10월 30일
Hi Farz - you should be able to set the machine format when you open the file with fopen. See http://www.mathworks.com/help/matlab/ref/fopen.html#inputarg_machinefmt for details.
추가 답변 (1개)
aijiangzhao aixuwu
2021년 10월 27일
Hi,I encountered the same problem, did you solve it? Can you tell me?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Low-Level File I/O에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!