(Or change the properties of the first rectangle)
I had 2 ideas of how to replace the rectangle, but both don't work. But here they are:
Idea 1:
r = findobj('FaceColor', [0.2 0.2 0.7])
r.FaceColor = [0.2 0.2 0.2]
Idea 2:
r = rectangle(findobj('FaceColor', [0.2 0.2 0.7]))
r.FaceColor = [0.2 0.2 0.2]
Idea 3:
r = findobj('FaceColor', [0.2 0.2 0.7])
rectangle('Position',r.Position,'LineWidth',1, 'FaceColor', [0.2 0.2 0.7])
I think you can't story a rectangle in a variable but I'm not sure and don't know how to do it otherwise. I want to change the facecolor of the rectangle with the facecolor [0.2 0.2 0.7].
2 Comments
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/502679-how-to-replace-a-rectangle-with-another-rectangle#comment_791544
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/502679-how-to-replace-a-rectangle-with-another-rectangle#comment_791544
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/502679-how-to-replace-a-rectangle-with-another-rectangle#comment_791634
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/502679-how-to-replace-a-rectangle-with-another-rectangle#comment_791634
Sign in to comment.