How to get and set handles of GUI1 in GUI2 (GUI1 and GUI2 are stored in a different folders)

1 回表示 (過去 30 日間)
Hi everyone.
my question is:
I have for exemple to GUIs(GUI1 und GUI2). in every GUI there are so many figures(edittext ,Text, Pushbutton,...). what I want is, to have a ability to access to every figure of any GUI (for exemple handles.edittext1 from GUI1) in another GUI(for exemple GUI2). Note: the GUI1 and GUI2 are in a different folders
I use MATLAB R2017b

採用された回答

Sarah Mohamed
Sarah Mohamed 2018 年 1 月 5 日
Hello Joe!
I think you'll find the example for sharing data between GUIs at the following page helpful:
https://www.mathworks.com/help/matlab/creating_guis/share-data-among-callbacks.html#bvih9xi
You can also take a look at the following video tutorial discussing this subject:
https://blogs.mathworks.com/videos/2005/10/03/guide-video-part-two/
  1 件のコメント
joe
joe 2018 年 1 月 10 日
hello Sarah!
thank you for your help.
this is how i solve it
function push_buttonGUI2_Callback(hObject, eventdata, handles)
% this is a button inside a GUI2
% Run GUI1
GUI1 % run GUI1
% Get the tag of the object to be able to access on it
h=findall(0,'tag','edit_TextGUI1'); % let say edit text in GUI1
% set a number/name inside edit text of GUI1
set(h,'String', ' I can controll you now :)');
% get the Content
Content = get(h,'String');
% Get the tag of selected_file (pushbutton) to be able to access on it
g_m=findobj('tag','push_buttonGUI1');
% Get handles of GUI1
gd_m=guidata(g_m);
% click on the button of GUI1 from GUI2
GUI1('push_buttonGUI1_Callback',gd_m.selected_file,[],gd_m);

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

その他の回答 (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