一个简单的matlab图形界面程序GUI

一个简单的matlab图形界面程序GUI

function varargout = showGUI(varargin)
% SHOWGUI MATLAB code for showGUI.fig
%      SHOWGUI, by itself, creates a new SHOWGUI or raises the existing
%      singleton*.
%
%      H = SHOWGUI returns the handle to a new SHOWGUI or the handle to
%      the existing singleton*.
%
%      SHOWGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SHOWGUI.M with the given input arguments.
%
%      SHOWGUI('Property','Value',...) creates a new SHOWGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before showGUI_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to showGUI_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help showGUI

% Last Modified by GUIDE v2.5 08-Jun-2013 21:53:16

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',      mfilename, ...
                  'gui_Singleton',  gui_Singleton, ...
                  'gui_OpeningFcn', @showGUI_OpeningFcn, ...
                  'gui_OutputFcn',  @showGUI_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
% End initialization code - DO NOT EDIT

function showGUI_OpeningFcn(hObject, eventdata, 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 showGUI (see VARARGIN)

% Choose default command line output for showGUI
    handles.output = hObject;
    guidata(hObject, handles);

% UIWAIT makes showGUI wait for user response (see UIRESUME)
% uiwait(handles.showGUI);

% --- Outputs from this function are returned to the command line.
function varargout = showGUI_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Executes on button press in runBut.
function runBut_Callback(hObject, eventdata, handles)
% hObject    handle to runBut (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    maxRunTime = 10;
    current_run_no = str2double(get(handles.beginValue, 'String'));
    if (get(handles.rdch, 'Value') == get(handles.rdch, 'Max'))
        if runtime_number_check(handles, current_run_no) == 1
            current_run_no = mod((current_run_no + 1), maxRunTime);
            if current_run_no == 0
                current_run_no = maxRunTime;
            end
            set(handles.beginValue, 'String', num2str(current_run_no));
            curimno = str2double(get(handles.imgNo, 'String'));
            if imgno_number_check(curimno, handles) ~= -1
                gui_contents_update(handles, curimno);
            end
        end
    else
        running_testfunc(handles);
    end

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/80870949e2c8b65d9c1641a4b17a3f93.html