findobj does not work

7 ビュー (過去 30 日間)
Rocky Zhang
Rocky Zhang 2020 年 3 月 4 日
コメント済み: Rocky Zhang 2020 年 3 月 5 日
When the gui main program is running, I use findobj('Name', 'Gui_Main_Program');
This command does not work in timer callback function. It neither work in Matlab command window.
I see everyone says do not use global variables, so I put data in gui_main_hObject.UserData.
Thank you.
  2 件のコメント
Star Strider
Star Strider 2020 年 3 月 4 日
The first argument to findobj must the the handle to the object you want to use it with.
Walter Roberson
Walter Roberson 2020 年 3 月 4 日
No, https://www.mathworks.com/help/matlab/ref/findobj.html shows multiple syntaxes in which there is no object passed

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 3 月 4 日
Either there is no object with exactly that name, or else the handle of it is not visible.
What shows up for
get(findall('type', 'figure'), 'Name')
  3 件のコメント
Walter Roberson
Walter Roberson 2020 年 3 月 4 日
get(findall(0, 'type', 'figure'), 'Name')
I keep forgetting that findall requires a first parameter
Rocky Zhang
Rocky Zhang 2020 年 3 月 5 日
This one works.
Thank you Walter!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by