- The GUIDE program creates guis using both an *.m file (what you posted) and a *.fig file (you did not post). You'd need to upload both in order for anyone to recreate your error.
- Good news though, your issue seems simple: Check out the uiwait and uiresume commands. Call uiwait at the end of the Main Fcn, then uiresume in the pushbutton fcn
Wait for user input after pressing button
6 次查看(过去 30 天)
显示 更早的评论
Hello,
I created a "OK" button using the guide template in Matlab. Here is the code:
function varargout = prompt11(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @prompt11_OpeningFcn, ...
'gui_OutputFcn', @prompt11_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 prompt11_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
guidata(hObject, handles);
function varargout = prompt11_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function pushbutton1_Callback(hObject, eventdata, handles)
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
How can I go about pausing my program until the user hits the "OK" button?
My code looks like this:
prompt11
my code
my code
my code
0 个评论
回答(1 个)
Meade
2016-4-20
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!