Number of digits in static text in GUI

18 Ansichten (letzte 30 Tage)
Stefan
Stefan am 2 Nov. 2011
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?

Antworten (2)

Fangjun Jiang
Fangjun Jiang am 2 Nov. 2011
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 am 2 Nov. 2011
Great, that works!
Thanks a lot!

Kategorien

Mehr zu Text Data Preparation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by