필터 지우기
필터 지우기

Show more digit number in command window

조회 수: 13 (최근 30일)
armin m
armin m 2021년 12월 4일
댓글: armin m 2021년 12월 5일
Hi. I wanna see 6 digits numbers in command window for output tesult.
Digits(6)
Why above code does not work? Tnx

채택된 답변

Voss
Voss 2021년 12월 5일
https://www.mathworks.com/help/symbolic/digits.html

추가 답변 (1개)

Steven Lord
Steven Lord 2021년 12월 5일
Are you trying to display a numeric result (in which case you should use the format function to change the format used to display numeric results) or a symbolic result (in which case you could use vpa)?
  댓글 수: 3
Walter Roberson
Walter Roberson 2021년 12월 5일
편집: Walter Roberson 2021년 12월 5일
Digits() only affects floating point symbolic numbers; it has no affect on double precision or single precision.
There is no method to get exactly 6 digits in the command window. "format short" will give you 5 digits, and "format long g" will give you 15 digits. There is no way to customize the display to 6 digits.
However... if you were to round(TheData, 6) and display it with "format long g" in effect, you would mostly see 6 or fewer digits
format short
A = rand(2,5);
A
A = 2×5
0.0877 0.6087 0.5334 0.8574 0.2875 0.7265 0.7497 0.2620 0.2137 0.0151
round(A,6)
ans = 2×5
0.0877 0.6087 0.5334 0.8574 0.2875 0.7265 0.7497 0.2620 0.2137 0.0151
format long g
A
A = 2×5
0.0877053423480108 0.6087128353141 0.533427760450286 0.857432414107602 0.287492789116849 0.726472632732573 0.749749130180543 0.262043559790102 0.213660341475538 0.0150908977443623
round(A,6)
ans = 2×5
0.087705 0.608713 0.533428 0.857432 0.287493 0.726473 0.749749 0.262044 0.21366 0.015091
armin m
armin m 2021년 12월 5일
Tnx

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by