필터 지우기
필터 지우기

Getting a numeric graphics handle for a patch?

조회 수: 9 (최근 30일)
alan cheville
alan cheville 2017년 9월 14일
댓글: alan cheville 2017년 9월 15일
I need to get a numeric handle to a patch object in R2017A. Both get(gca,'Children') and findobj return a struct with all the graphic object properties except the handle. A post referring to R2014 mentions I can get this using the 'Number' property, but this doesn't seem to exist anymore. Here is the link to the article: https://www.mathworks.com/help/matlab/graphics_transition/graphics-handles-are-now-objects-not-doubles.html#budq3uo-1
This seems like it should be simple but I am stuck!
Thanks, Alan
  댓글 수: 2
Steven Lord
Steven Lord 2017년 9월 15일
Why do you need the numeric handle?
alan cheville
alan cheville 2017년 9월 15일
I need to create a unique numeric identifier for a graphics object.

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

채택된 답변

Walter Roberson
Walter Roberson 2017년 9월 14일
double() the handle. You can handle() the result to get back the object.
Note: the Number property applies only for figures.
>> aaa = patch(nan,nan,nan)
aaa =
Patch with properties:
FaceColor: 'flat'
FaceAlpha: 1
EdgeColor: [0 0 0]
LineStyle: '-'
Faces: 1
Vertices: [NaN NaN]
Show all properties
>> double(aaa)
ans =
0.0001220703125
>> handle(ans)
ans =
Patch with properties:
FaceColor: 'flat'
FaceAlpha: 1
EdgeColor: [0 0 0]
LineStyle: '-'
Faces: 1
Vertices: [NaN NaN]
Show all properties
  댓글 수: 1
alan cheville
alan cheville 2017년 9월 15일
Brilliant, that worked well. Thanks for the fast response.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by