b=fprintf how to
조회 수: 2 (최근 30일)
이전 댓글 표시
a=2.65987 ,after using the fprintf('%0.5g\n',a) i get the value i want being 2.6599 i tried doing b=fprintf('%0.5g\n',a) (i wanted to keep a better track of my work ) but it modified my result into 7 ,is there a way of keeping the b=fprintf('%0.5g\n',a) and still keeping the initial value 2.6599 ?
댓글 수: 0
채택된 답변
Star Strider
2020년 10월 30일
b=sprintf('%0.5g\n',a)
It is a separate line of code, however you get to retain the result.
댓글 수: 2
Star Strider
2020년 10월 30일
As always, my pleasure!
In your original fprintf call, ‘b’ was the number of bytes fprintf wrote. See Get Number of Bytes Written to File for an detailed explanation.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!