Number of digits in static text in GUI

Hi,
How can I specify the precision a static text element in a GUI displays?
I use "set(handles.result,'String',result)" to set the value to the static text element but it only shows 4 digits.
I'd bet there is a very simple way to set the number of digits. Does anyone know how to do that?

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2011년 11월 2일

1 개 추천

Your variable 'result' must be a string. If you use num2str(), the default precision is 4 digits, such as num2str(pi) shows 3.1416. You can use num2str(pi,'%20.10f'), or you can use sprintf().
Stefan
Stefan 2011년 11월 2일

0 개 추천

Great, that works!
Thanks a lot!

카테고리

도움말 센터File Exchange에서 Text Data Preparation에 대해 자세히 알아보기

질문:

2011년 11월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by