How to return value from an axes ?

조회 수: 1 (최근 30일)
yogesh jain
yogesh jain 2016년 2월 29일
답변: Deependra Mishra 2018년 12월 13일
Hello all, How to return value of an axes in GUI, which is typically a numeric value. That value can be used to handle the axes outside the axes function also. thank you

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 29일
As of R2014b, graphics handles are no longer numeric values. There is not a lot of reason to need a numeric value for a graphics handle: you can just store and pass around the object-oriented handle instead.
If you really really need to get to the numeric value for some reason, then you can double() the object-oriented handle, but be warned that if you do so the recipients cannot make use of that to refer to the axes, not without using handle() on it. The only reason I have ever had for needing to know the numeric value of a graphics handle (other than a figure handle) is for debugging.
If you want to know the handle of the "current" axes, then call gca()
If you built the axes using GUIDE, and gave it a Tag, then you can pull its handle out of the "handles" structure by using the Tag as a field name.
If you create the axes at run-time, then record its handle and pass that around as needed
ax1 = axes('Units', 'norm', 'Position', [0 0 .3 .3]);
....
do_something_with_an_axes(ax1)
If you want to know the axes that a particular drawing object such as a lineseries object, then you can use ancestor(HandleOfGraphicsObject, 'axes')
If you created the axes with a Tag and the Tag is unique, you can findobj() or findall() against the Tag to find the axes. (If the tag is not unique, you would get all of the objects with the tag.) This is slower than the alternatives listed above, but can be very convenient.
  댓글 수: 2
yogesh jain
yogesh jain 2016년 2월 29일
Hello Mr. Roberson , Thank you. I want to ask that how can I change this approach for using in GUIs . question It uses subplot function for showing children axes but I am using different axes in GUI . What should be the changes ?
Thanks again :)
Walter Roberson
Walter Roberson 2016년 2월 29일
Nothing I have written is any different for GUI, other than the fact that when I am writing a GUI I would be even less likely to look at the numeric value of a handle and more likely to store the handles and refer to the stored handles.

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

추가 답변 (1개)

Deependra Mishra
Deependra Mishra 2018년 12월 13일
Here is a link I found, anyone one who come across this might want to have a look at...

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by