Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 在子GUI中单击关闭按钮后,使按钮在maingui中可见_Matlab_User Interface_Matlab Figure - Fatal编程技术网

Matlab 在子GUI中单击关闭按钮后,使按钮在maingui中可见

Matlab 在子GUI中单击关闭按钮后,使按钮在maingui中可见,matlab,user-interface,matlab-figure,Matlab,User Interface,Matlab Figure,我有一个带有两个按钮的主gui。第一个按钮打开一个子GUI,另一个按钮是“运行”按钮,它是'Enable'=Off。它是灰色的,不可点击。我知道我可以通过以下命令打开启用按钮:set(handles.start_按钮、'enable'、'on') 我通过单击“关闭”按钮在子GUI中执行此命令 我如何告诉他在主gui中设置命令 错误:引用不存在的字段“启动按钮” 由于在主GUI中定义了start\u按钮,因此它在子GUI的句柄结构中不可用。您需要在子GUI的句柄结构中存储主GUI的句柄 % Fro

我有一个带有两个按钮的主gui。第一个按钮打开一个子GUI,另一个按钮是“运行”按钮,它是
'Enable'=Off
。它是灰色的,不可点击。我知道我可以通过以下命令打开启用按钮:
set(handles.start_按钮、'enable'、'on')
我通过单击“关闭”按钮在子GUI中执行此命令

我如何告诉他在主gui中设置命令

错误:引用不存在的字段“启动按钮”


由于在主GUI中定义了
start\u按钮
,因此它在子GUI的
句柄
结构中不可用。您需要在子GUI的
句柄
结构中存储主GUI的句柄

% From within your main GUI
hfig = subGUI();

% Add the (current) main GUI handle to the subGUI handles
handles = guidata(hfig);

handles.parentGUI = hObject;
guidata(hfig, handles);
然后从子GUI回调中:

% Get the GUIDATA from the parent GUI
parentdata = guidata(handles.parentGUI);

% Change the pushbutton property
set(parentdata.start_pushbutton, 'Enable', 'on');
或者您可以在
uicontrol
上使用
标签
,以便您可以从其他GUI中找到它

% From the GUI that has this button
uicontrol('Tag', 'MyPushButton')

% From the button that was defined in the parent GUI
button = findall(0, 'Tag', 'MyPushButton');
set(button, 'Enable', 'on')
% From the GUI that has this button
uicontrol('Tag', 'MyPushButton')

% From the button that was defined in the parent GUI
button = findall(0, 'Tag', 'MyPushButton');
set(button, 'Enable', 'on')