필터 지우기
필터 지우기

format numbers in plot

조회 수: 8 (최근 30일)
Haris Hameed
Haris Hameed 2012년 4월 25일
hi
i am using text command to show variable value in plot
but i am not able to format this variable (format short)
text(5,3,['variable value=',char(a)]) i get variable value = 0.324546494654894846156486494646
so how to format it to 0.32454

채택된 답변

Daniel Shub
Daniel Shub 2012년 4월 25일
instead of your char(a)
I would use
num2str(double(a), 6)
or
sprintf('%0.6f', double(a))
  댓글 수: 3
Daniel Shub
Daniel Shub 2012년 4월 25일
See my edit. I missed your "a" was a sym. You need to convert the sym to a double first.
Haris Hameed
Haris Hameed 2012년 4월 25일
thankx it works

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

추가 답변 (0개)

카테고리

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