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
在MatlabGUI的输出函数中使用uiwait处理空结构_Matlab_User Interface_Matlab Guide - Fatal编程技术网

在MatlabGUI的输出函数中使用uiwait处理空结构

在MatlabGUI的输出函数中使用uiwait处理空结构,matlab,user-interface,matlab-guide,Matlab,User Interface,Matlab Guide,我想根据这一点使用uiwait在GUI之间共享数据。 但是如果我调用uiwait(handles.figure1)句柄结构在uitest\u OutputFcn处为空 function varargout = uitest(varargin) % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ...

我想根据这一点使用uiwait在GUI之间共享数据。 但是如果我调用
uiwait(handles.figure1)句柄结构在
uitest\u OutputFcn
处为空

function varargout = uitest(varargin)

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @uitest_OpeningFcn, ...
                   'gui_OutputFcn',  @uitest_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before uitest is made visible.
function uitest_OpeningFcn(hObject, eventdata, handles, varargin)

% Choose default command line output for uitest
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes uitest wait for user response (see UIRESUME)
% --> enable to generate error
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = uitest_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --------------------------------------------------------------------
function menuClose_Callback(hObject, eventdata, handles)
% hObject    handle to menuClose (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

uiresume(handles.figure1);

close(handles.figure1);

不能在关闭功能中删除图形:

% --- Outputs from this function are returned to the command line.
function varargout = uitest_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% The figure can be deleted now
delete(handles.figure1);

% --------------------------------------------------------------------
function menuClose_Callback(hObject, eventdata, handles)
% hObject    handle to menuClose (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

close(handles.figure1);

% --- Executes when user attempts to close figure1.
function figure1_CloseRequestFcn(hObject, eventdata, handles)
% hObject    handle to figure1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: delete(hObject) closes the figure
if isequal(get(hObject, 'waitstatus'), 'waiting')
    % The GUI is still in UIWAIT, us UIRESUME
    uiresume(hObject);
else
    % The GUI is no longer waiting, just close it
    delete(hObject);
end

谢谢你的回答,我很难找到这个问题的答案。在按钮回调函数中使用“close(handles.figure1);”也为我解决了这个问题。