How to return value from an axes ?

3 ビュー (過去 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 Center および File ExchangeGraphics Object Properties についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by