我正在创建一个用户输入一个值的图形用户界面,当他按下一个按钮时,它会运行一个外部函数并显示错误消息。我无法在GUI编码中成功插入变量。我很困惑,在哪里插入我的变量。我试过手柄,但不幸的是它没有工作。图形用户界面的问题,无法使用手柄来存储变量
% --- Executes just before Stallfunction is made visible.
function Stallfunction_OpeningFcn(hObject, ~, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Stallfunction (see VARARGIN)
% Choose default command line output for Stallfunction
handles.user_entry = user_entry;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Stallfunction wait for user response (see UIRESUME)
% uiwait(handles.figure1);
我已经插在上面的代码中,这是“user_entry”的变量是正确的吗?
GUI不通过传递值来启动。我有GUI界面,然后我在编辑框中输入一个值并按下按钮来运行另一个功能。你指的是同一件事吗? – user1860036 2013-03-10 19:28:13
@ user1860036:在这种情况下,您必须填写编辑框的回调,以便将该框的内容写入'handles.user_entry'中。 – Jonas 2013-03-10 21:00:39