从Matlab GUI获取输出数据

时间:2015-03-02 16:11:24

标签: matlab matlab-guide

我使用GUIDE创建了一个称为比较的Matlab GUI,但直到现在我还没有设法在没有get错误的情况下检索输出。我的代码是:

function varargout = comparison(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @comparison_OpeningFcn, ...
                   'gui_OutputFcn',  @comparison_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

function comparison_OpeningFcn(hObject, eventdata, handles, varargin)

handles.Receiver=zeros(1,15);
handles.Signal=zeros(1,4);
handles.CCCcombination=zeros(1,5);
handles.FilterFlag=0;

handles.output = hObject;

guidata(hObject, handles);

uiwait(handles.figure1);

function varargout = comparison_OutputFcn(hObject, eventdata, handles) 

varargout{1} = handles.output;

uiresume(handles.figure1);
delete(handles.figure1);

function Close_button_Callback(hObject, eventdata, handles)

handles.CCCcombination=zeros(1,5);
handles.Signal=zeros(1,4);
handles.Receiver=zeros(1,5);
handles.FilterFlag=0;
s.Receiver=handles.Receiver;
s.Signal=handles.Signal;
s.CCCcombination=handles.CCCcombination;
s.FilterFlag=handles.FilterFlag;
handles.output=s;
guidata(hObject, handles);
comparison_OutputFcn(hObject, eventdata, handles)

运行comparison时,我的输出如下:

s=comparison
ans = 
          Receiver: [0 0 0 0 0 0 0 0 1 1 0 0 0 0 0]
            Signal: [0 0 0 0]
    CCCcombination: [0 0 0 0 0]
        FilterFlag: 0
Attempt to reference field of non-structure array.
Error in comparison>comparison_OutputFcn (line 106)
varargout{1} = handles.output;

0 个答案:

没有答案