필터 지우기
필터 지우기

Where are all drawn shapes stored from an axis?

조회 수: 4 (최근 30일)
Joseph Henry
Joseph Henry 2019년 7월 16일
편집: Adam Danz 2019년 7월 19일
Let's say that I have an axis and I draw three shapes on it using drawrectangle.
Is there some way to call an array that holds the handles to each of these shapes?
Thanks
  댓글 수: 1
Adam
Adam 2019년 7월 16일
If you store them when you call drawrectangle and keep the output argument, yes.

댓글을 달려면 로그인하십시오.

채택된 답변

Adam Danz
Adam Danz 2019년 7월 16일
편집: Adam Danz 2019년 7월 19일
Store handles
In the block below, r1, r2, & r3 are handles to the 3 rectangles.
figure()
r1 = rectangle('Position',[0 0 2 4],'Curvature',0.2);
hold on
axis equal
r2 = rectangle('Position',[3 0 2 4],'Curvature',1);
r3 = rectangle('Position',[6 0 2 4],'Curvature',[0.5,1]);
Retrieve handles if they aren't stored
The line below search for objects of type "rectangle" in the current axes. For the plot created above, r would be a vector of object handles of size [3x1].
r = findobj(gca, 'Type', 'rectangle');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by