Chnage number display format
이전 댓글 표시
Hi,
The numbers in the first column of my output writing to a text file shows like 3e+006.
But I want to display like 3000001.
How can I change that in MATLAB?
Thanks.
답변 (1개)
Sean de Wolski
2014년 5월 23일
How are you writing it right now? If you are using fprintf you can change the format spec. For example:
fprintf(1,'%10.0f\n',randi(10,[5, 1])*2347348)
댓글 수: 4
Damith
2014년 5월 23일
Sean de Wolski
2014년 5월 23일
편집: Sean de Wolski
2014년 5월 23일
I would read in the entire file with csvread or dlmread, and then write it back out with dlmwrite which offers precision. IF you need finer control over the formatspec, then fprintf would work here as well.
Damith
2014년 5월 23일
Damith
2014년 5월 24일
카테고리
도움말 센터 및 File Exchange에서 Text Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!