フィルターのクリア

How to get specific axes handle in GUI with more then one axes?

1 回表示 (過去 30 日間)
SturmGhost
SturmGhost 2018 年 4 月 20 日
コメント済み: SturmGhost 2018 年 4 月 20 日
Say I have GUI_1 with several axes. Now I start GUI_2 changes some settings and the corresponding axes in GUI_1 should change corresponding to the changes in GUI_2. Problem is I can't get the right axes-handle to refresh the correct axes.
findobj(HandleToGUI_1, 'type', 'axes')
gives me all axes and...
findobj(HandleToGUI_1, 'type', 'axes', '-and', 'Tag', 'TagForMySpecificAxes')
doesn't work...
How can I get the handle for my specific axes?
  3 件のコメント
Dennis
Dennis 2018 年 4 月 20 日

you can assign a handle when you create the axes

handles.axes1=axes('Position',[0.86 0 0.15 0.15])
SturmGhost
SturmGhost 2018 年 4 月 20 日

@Jan

I will get an empty GraphicsPlaceholder as a handle.

HandleVisibility is on.

If I run my second example without the '-and' code inside GUI_1.m it works. Unfortunately, if I call my refresh function from GUI_2.m it doesn't finde the handle. To access my refresh function (which is located in GUI_1.m) from GUI_2.m I use

setappdata(gcf, 'fhUpdateFilterPreview', @UpdateFilterPreview);

in GUI_1.m at the GUI_OpeningFcn function and in GUI_2.m

fhUpdateFilterPreview = getappdata(hImageAnalyzer, 'fhUpdateFilterPreview');
[...]
feval(fhUpdateFilterPreview);

@Dennis

GUIDE will already assign a handle to the axes. Problem is, if I call my refresh function from GUI_2, I don't have this handle accessible.

サインインしてコメントする。

採用された回答

Jan
Jan 2018 年 4 月 20 日
編集済み: Jan 2018 年 4 月 20 日

If the figure was created by GUIDE:

handles_GUI1 = guidata(HandleToGUI_1);
handles_GUI1.TagForMySpecificAxes   % May be called specifically, perhaps 'axes_<TAG>' 

You can store the wanted object manually by guidata also, when you do not use GUIDE. Using an already stored handle is faster than searching dynamically. If there is a huge number of elements in the GUI (hundreds), the delay is noticable.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by