필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

writing data to a file

조회 수: 2 (최근 30일)
Sujeet Mishra
Sujeet Mishra 2012년 5월 14일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi , I have to write big integer numbers into a file (in signed decimal format).I am using "fprintf(fid,'%d\n',data)" command.But the number say 262206552555 is written in the file like 2.6221e11 whereas I want it as 262206552555 .If I use '%f' then i get the full number but with trailing zeros .Please tell how I should go about .

답변 (1개)

Thomas
Thomas 2012년 5월 14일
Hmm.. I am unable to reproduce your circumstance..
d=262206552555
fid = fopen('new1.txt', 'w');
fprintf(fid,'%d\n',d);
fclose(fid)
Gives me the output in the file as 262206552555 and not as 2.6221e11
  댓글 수: 2
Sujeet Mishra
Sujeet Mishra 2012년 5월 15일
I also am suing the same command as yours.Is there any other setting which may affect??
Walter Roberson
Walter Roberson 2012년 5월 15일
Sujeet, experiment with using
fprintf(fid, '%d\n', round(d));

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by