Effacer les filtres
Effacer les filtres

How can I set multiple text descriptions' colours at one time

2 vues (au cours des 30 derniers jours)
Greer Gray
Greer Gray le 28 Nov 2018
Commenté : madhan ravi le 29 Nov 2018
Suppose I have
xt = [1 2 3 4];
yt = [1 2 3 4];
str = {'one','two','three','four'};
tt = text(xt,yt,str);
xlim([0 5])
ylim([0 5])
How do I set 1 and 3 to the color red together without a loop
i.e. tt([1 3]).Color = 'r'

Réponse acceptée

madhan ravi
madhan ravi le 28 Nov 2018
[tt(1).Color,tt(3).Color] = deal('r')
  2 commentaires
Greer Gray
Greer Gray le 29 Nov 2018
Thanks
madhan ravi
madhan ravi le 29 Nov 2018
Anytime :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Entering Commands 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!

Translated by