Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

writing data to a file

2 Ansichten (letzte 30 Tage)
Sujeet Mishra
Sujeet Mishra am 14 Mai 2012
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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 .

Antworten (1)

Thomas
Thomas am 14 Mai 2012
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 Kommentare
Sujeet Mishra
Sujeet Mishra am 15 Mai 2012
I also am suing the same command as yours.Is there any other setting which may affect??
Walter Roberson
Walter Roberson am 15 Mai 2012
Sujeet, experiment with using
fprintf(fid, '%d\n', round(d));

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by