Print number as .0000000E+00
조회 수: 3 (최근 30일)
이전 댓글 표시
I would like to print a number with the following format:
.0000000E+00
MATLAB prefers the following:
0.0000000E+000
Is there a way to solve this issue?
댓글 수: 0
채택된 답변
추가 답변 (1개)
Pourya Alinezhad
2013년 6월 18일
fprintf('%1.5s',0.1)
1.5 stands for 5 decimal places.1 is for full number.
s==scientific
you could easily find a way to this problem if you were a c proogrammer...
댓글 수: 3
Pourya Alinezhad
2013년 6월 18일
actually i didn't checked this code in matlab.i used to code in this way in turbo c.and i per-assumed that this is true in matlab :)
Jan
2013년 6월 19일
@Pourya: And obviously your assumption is not really wrong. Thanks for this interesting new piece of information.
Of course TMW did not implement fprintf from scratch but relies on existing libraries. Therefore even known bugs like buffer overflows and other undocumented features like %s with numbers appear in Matlab.
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!