Displaying output in Static box
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
fary
am 26 Feb. 2018
Kommentiert: fary
am 1 Mär. 2018
Good day all, please I am working on a project that counts the blood cell, I want the output of the count to display in a static box when I click on the pushbutton "RBC Count", presently my output been printed on the command window. Please I am looking forward to your help
0 Kommentare
Akzeptierte Antwort
Cam Salzberger
am 26 Feb. 2018
Hello Fary,
When you create the static text, you should get the handle to the object out of it. Then you can have the callback for the pushbutton modify the 'String' property of the static text. For example:
figure
hText = uicontrol('Style', 'text', 'String', 'Waiting...', ...
'Units', 'normalized', 'Position', [0 0.5 0.5 0.5]);
uicontrol('Style', 'pushbutton', 'Callback', ...
@(src, event) set(hText, 'String', 'whatever'))
Of course, if you're doing a GUIDE GUI, you will usually have all the handles to the uicontrols (and other UI elements) in the handles struct that gets passed around. In that case, just access the handle to the static text in that (named by the 'Tag' property for the text) and modify the text in the pushbutton callback.
handles.text1.String = 'whatever you want';
-Cam
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks 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!