필터 지우기
필터 지우기

fread + double-precision 8-byte floating point + precision

조회 수: 2 (최근 30일)
Farz Tak
Farz Tak 2015년 10월 29일
답변: aijiangzhao aixuwu 2021년 10월 27일
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

채택된 답변

Geoff Hayes
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
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.
Farz Tak
Farz Tak 2015년 10월 30일
It is LSB format data but putting 'l' did not help me in reading the data.

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

추가 답변 (1개)

aijiangzhao aixuwu
aijiangzhao aixuwu 2021년 10월 27일
Hi,I encountered the same problem, did you solve it? Can you tell me?

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by