MATLAB Answers

0

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

Asked by Greer Gray on 28 Nov 2018
Latest activity Commented on by madhan ravi
on 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'

  0 Comments

Sign in to comment.

1 Answer

Answer by madhan ravi
on 28 Nov 2018
 Accepted Answer

[tt(1).Color,tt(3).Color] = deal('r')

  2 Comments

Sign in to comment.