필터 지우기
필터 지우기

dlmwrite is printing the wrong number

조회 수: 2 (최근 30일)
Juliette Salexa
Juliette Salexa 2015년 1월 5일
편집: Star Strider 2015년 1월 5일
dlmwrite('a.txt',288230387962871929,'precision',40);
Creates a file with one number listed:
288230387962871940
I thought this might be due to using a 32-bit version of MATLAB. I then tried with a machine running 64-bit MATLAB, I got:
288230387962871936
Why doesn't it print 288230387962871929 like I asked it to ?

답변 (1개)

Star Strider
Star Strider 2015년 1월 5일
편집: Star Strider 2015년 1월 5일
The reason it is writing ‘288230387962871936’ instead of ‘288230387962871929’ is explained by the error the ‘qd’ calculations throws in this code snippet:
qb = dec2bin(288230387962871929);
qd = bin2dec(qb);
Error using bin2dec (line 35)
Binary string must be 52 bits or less.

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by