adding trailing 0s to inputted numbers
조회 수: 39 (최근 30일)
이전 댓글 표시
Is there a way to add trailing 0s after they are inputted in MATLAB (ex turning 4 -> 4.0 or 4.00?) my code wont work unless the sigfigs match but i found rounding them in the matrix using M = round(M,4,"decimals") or M = round(M,4,"significant") just keeps it at the same integer value.
Thank you!
댓글 수: 1
답변 (1개)
Eric Delgado
2022년 9월 19일
You have to use strings to control the number of decimals.
sprintf('%.1f', 4)
sprintf('%.2f', 4)
sprintf('%.6f', 4)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!