필터 지우기
필터 지우기

Format Number in Edit Text Box

조회 수: 2 (최근 30일)
Alex
Alex 2016년 9월 21일
댓글: Geoff Hayes 2016년 9월 21일
Hi all, I have a GUI with several edit text boxes. Is there any way to change the format of a number in a text Box ? For example: 4.45567e2, but I want the longG format "445,567" so that it is more readable. Is this possible ? i will apreciate any Help Alex

채택된 답변

Geoff Hayes
Geoff Hayes 2016년 9월 21일
Alex - try using sprintf to format your data. For example,
set(handles.edit1,'String',sprintf('%.3f',pi))
would set the text in the edit control to 3.142. We use the .3 to indicate that we want three decimal places.
  댓글 수: 2
Alex
Alex 2016년 9월 21일
HI Geoff,
thanks for the Quick answer, do u know if it is Possible to define the Postion of a Number in the Text Box for example (in the middle of the Text box)
Geoff Hayes
Geoff Hayes 2016년 9월 21일
Hi Alex - you can set the HorizontalAlignment to centre so that the text is centred within the edit control. (I think that this may be the default setting for this property.)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by