📄 apsuat_gui.m
字号:
function varargout = apsuat_gui(varargin)% APSUAT_GUI Application M-file for apsuat_gui.fig% FIG = APSUAT_GUI launch apsuat_gui GUI.% APSUAT_GUI('callback_name', ...) invoke the named callback.% Last Modified by GUIDE v2.0 16-May-2003 20:19:16if nargin == 0 % LAUNCH GUI fig = openfig(mfilename,'reuse'); % Use system color scheme for figure: set(fig,'Color',get(0,'defaultUicontrolBackgroundColor')); % Generate a structure of handles to pass to callbacks, and store it. handles = guihandles(fig); guidata(fig, handles); if nargout > 0 varargout{1} = fig; endelseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK try [varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard catch disp(lasterr); endend%|--------------------Generated by Truong Hoang Long-----------------------function startglobal handles M myfig% handles = guihandles(findall(0,'type','figure','Tag','zelda')); aps = eval(get(handles.data_muc,'String')); if aps < 0.5 | aps > 2 set_param('apsuat','SimulationCommand','stop') msgbox('Thiet bi dieu khien nay chi dieu khien cac ap suat trong khoang tu 0.5->2 at. Neu muon co nhung he thong dieu khien ap suat tu 0->100 at, lien he tac gia: longhoangtruong@yahoo.com','Thong so khong phu hop','Error') return end M = aps; set_param('apsuat','SimulationCommand','update'); figure(myfig); set(handles.status_text,'String','Press stop to end Fuzzy Control'); set(handles.start_cb,'Enable','off'); set(handles.stop_cb,'Enable','on'); set(handles.popmenu,'Enable','off'); set(handles.data_muc,'Enable','off');% if get(myfig,'Visible')=0% set(myfig,'Visible','on')% end if strcmp(get_param('apsuat','SimulationStatus'),'stopped') set_param('apsuat','SimulationCommand','start') return end% --------------------------------------------------------------------function stopglobal handles%handles = guihandles(findall(0,'type','figure','Tag','zelda')); set(handles.status_text,'String','Choose your parameters then press start'); set(handles.start_cb,'Enable','on'); set(handles.stop_cb,'Enable','of'); set(handles.popmenu,'Enable','on'); set(handles.data_muc,'Enable','on'); if strcmp(get_param('apsuat','SimulationStatus'),'running') set_param('apsuat','SimulationCommand','stop') return end% --------------------------------------------------------------------function doneglobal myfig%myfig=findall(0,'type','figure','Tag','zelda'); delete(myfig);% set(myfig,'Visible','off')% --------------------------------------------------------------------%| ABOUT CALLBACKS:%| GUIDE automatically appends subfunction prototypes to this file, and %| sets objects' callback properties to call them through the FEVAL %| switchyard above. This comment describes that mechanism.%|%| Each callback subfunction declaration has the following form:%| <SUBFUNCTION_NAME>(H, EVENTDATA, HANDLES, VARARGIN)%|%| The subfunction name is composed using the object's Tag and the %| callback type separated by '_', e.g. 'slider2_Callback',%| 'figure1_CloseRequestFcn', 'axis1_ButtondownFcn'.%|%| H is the callback object's handle (obtained using GCBO).%|%| EVENTDATA is empty, but reserved for future use.%|%| HANDLES is a structure containing handles of components in GUI using%| tags as fieldnames, e.g. handles.figure1, handles.slider2. This%| structure is created at GUI startup using GUIHANDLES and stored in%| the figure's application data using GUIDATA. A copy of the structure%| is passed to each callback. You can store additional information in%| this structure at GUI startup, and you can change the structure%| during callbacks. Call guidata(h, handles) after changing your%| copy to replace the stored original so that subsequent callbacks see%| the updates. Type "help guihandles" and "help guidata" for more%| information.%|%| VARARGIN contains any extra arguments you have passed to the%| callback. Specify the extra arguments by editing the callback%| property in the inspector. By default, GUIDE sets the property to:%| <MFILENAME>('<SUBFUNCTION_NAME>', gcbo, [], guidata(gcbo))%| Add any extra arguments after the last argument, before the final%| closing parenthesis.% --------------------------------------------------------------------function varargout = start_cb_Callback(h, eventdata, handles, varargin)% Stub for Callback of the uicontrol handles.pushbutton8.apsuat_gui start% --------------------------------------------------------------------function varargout = stop_cb_Callback(h, eventdata, handles, varargin)% Stub for Callback of the uicontrol handles.pushbutton8.apsuat_gui stop% --------------------------------------------------------------------function varargout = zelda_CloseRequestFcn(h, eventdata, handles, varargin)% Stub for DeleteFcn of the figure handles.zelda.apsuat_gui stop% --------------------------------------------------------------------function varargout = popmenu_Callback(h, eventdata, handles, varargin)% Stub for Callback of the uicontrol handles.popmenu.global KK = get(handles.popmenu,'Value');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -