Displaying output in Static box
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Cam Salzberger
le 26 Fév 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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!