How can I print a number on the edit field?

1 Ansicht (letzte 30 Tage)
studentmatlaber
studentmatlaber am 2 Jun. 2022
Kommentiert: Rik am 3 Jun. 2022
Hello everyone, I want to print numbers in the edit field, how can I do it?
PESQ=1;
set(handles.edit1,'string',num2str(PESQ));
  3 Kommentare
dpb
dpb am 2 Jun. 2022
hEd=uicontrol('Style','edit');
hEd.String=num2str(pi,3);
works as expected from command line so one would presume the above would work just fine assuming value of handles.edit1 is valid.
Using the dot notation to directly access the property is more easily coded than using set() unless setting more than one property at a time.
Rik
Rik am 3 Jun. 2022
The only downside of the dot notation is if you want compatibility with very old releases of Matlab. But since you seem to be using GUIDE, that point is moot.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Migrate GUIDE Apps 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