How do I change the color of the bar in a WAITBAR in MATLAB 7.5 (R2007b)?
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MathWorks Support Team
le 27 Juin 2009
Commenté : Adam Danz
le 10 Mai 2022
I want to know how I can use another color than red on the bar in my WAITBAR figure.
h=waitbar(0, 'Please wait...')
for i=1:1000
waitbar(i/1000)
end
close(h)
Réponse acceptée
MathWorks Support Team
le 27 Juin 2009
The “bar” in the WAITBAR figure is a patch object. Use the FINDOBJ function to find the patch handle. For more information about FINDOBJ, see the documentation:
doc findobj
or
web([docroot '/techdoc/ref/findobj.html'])
or
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/findobj.html>
To change the color of the patch you need to change its properties ‘EdgeColor’ and ‘FaceColor’. The example below describes how to do that:
h=waitbar(0, 'Please wait...');
hw=findobj(h,'Type','Patch');
set(hw,'EdgeColor',[0 1 0],'FaceColor',[0 1 0]) % changes the color to green
for i=1:1000
waitbar(i/1000)
end
close(h)
For more information about PATCH properties see the documentation:
web([docroot '/techdoc/ref/patch_props.html'])
or
<http://www.mathworks.com/access/helpdesk/help/techdoc/ref/patch_props.html>
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Dialog Boxes dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!