u014680360
安息静读
采纳率100%
2019-03-28 23:34

MATLAB GUI handles 无法传递?!!

10
已采纳

如下,MATLAB GUI handles 完全无法传递,function pushbutton1 完全得不到已经公共化的 PATH, Out 取值,这说明handles 没有传递出去,但到底是为什么?已略去各种注释和无关紧要的语句,方便大神们阅读,小妹跪求大神指点迷津。在 GUI__OpeningFcn 中定义 Global 也没有作用,不知什么原因?10个C币,望大神们不吝赐教。_

function [varargout,handles] = GUI(varargin)

gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUI_OpeningFcn, ...
'gui_OutputFcn', @GUI_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 GUI_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles)
handles = guidata(hObject);
handles.PATH=handles.edit1.String;
handles.Out_Address=handles.edit2.String;

function varargout = GUI_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
handles.PATH=handles.edit1.String;
handles.Out_Address=handles.edit2.String;

function edit1_Callback(hObject, eventdata, handles)
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

function edit2_Callback(hObject, eventdata, handles)
function edit2_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
handles

function pushbutton1_CreateFcn(hObject, eventdata, handles)
function pushbutton1_ButtonDownFcn(hObject, eventdata, handles)

function pushbutton1_Callback(hObject, eventdata, handles)
PATH=handles.PATH
Out_Address=handles.Out_Address

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • u014680360 安息静读 2年前

    实地运行一下试试,也许数据就过去了。

    点赞 评论 复制链接分享
  • zqbnqsdsmd zqbnqsdsmd 2年前
    点赞 评论 复制链接分享

为你推荐