Displaying output in Static box
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
fary
el 26 de Feb. de 2018
Comentada: fary
el 1 de Mzo. de 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 comentarios
Respuesta aceptada
Cam Salzberger
el 26 de Feb. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!