www.gusucode.com > gui 界面实现语音信号简单分析matlab源码程序 > 语音信号分析/VLGUI.m

    function varargout = VLGUI(varargin)
% VLGUI M-file for VLGUI.fig
%      VLGUI, by itself, creates a new VLGUI or raises the existing
%      singleton*.
%
%      H = VLGUI returns the handle to a new VLGUI or the handle to
%      the existing singleton*.
%
%      VLGUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in VLGUI.M with the given input arguments.
%
%      VLGUI('Property','Value',...) creates a new VLGUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before VLGUI_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to VLGUI_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 VLGUI

% Last Modified by GUIDE v2.5 14-Apr-2005 22:32:58

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @VLGUI_OpeningFcn, ...
                   'gui_OutputFcn',  @VLGUI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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


% --- Executes just before VLGUI is made visible.
function VLGUI_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 VLGUI (see VARARGIN)

% Choose default command line output for VLGUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% 加背景图片
axis(handles.axes4);
a = rand(1,32);
bar(a);
set(gca,'xticklabel',[],'yticklabel',[],'xlim',[0 32]);
% set(handles.axes4,'handleVisibility','off');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 可以在这里写入一些初始化操作
% 我这里以前写的是身份验证的一个小的加密的程序段

% sn
filename=matlabroot;
filename=[filename,'\VLGUIsn.bin'];
if(exist(filename)==0)
    fid=fopen(filename,'w+');
    fileattrib(filename,'+h');
    sn=[0,1];
    fwrite(fid,sn,'integer*4');
    fclose(fid);
else
    fid=fopen(filename,'r');
    sn=fread(fid,2,'int32');
    fclose(fid);
    if(sn(1)==0)
        num=sn(2)+1;
        sn(2)=num;
        if(num>5)
            answer=inputdlg('请输入注册号:','Please enter your SN');
            if(~isempty(answer))
                str=answer{1};
                snn=str2num(str);
                if snn==1234321
                    sn(1)=1;
                    fileattrib(filename,'-h');
                    fid=fopen(filename,'w');
                    fwrite(fid,sn,'integer*4');
                    fclose(fid);
                    fileattrib(filename,'+h');
                else
                    uiwait(msgbox('输入的注册号不正确!','注册号出错','error','modal'));
                    set(handles.EnterBtn,'Enable','off');
                end
            else
                uiwait(msgbox('输入的注册号不正确!','注册号出错','error','modal'));
                set(handles.EnterBtn,'Enable','off');
            end
        else
            fileattrib(filename,'-h');
            fid=fopen(filename,'w');
            fwrite(fid,sn,'integer*4');
            fclose(fid);
            fileattrib(filename,'+h');
        end
    end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


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



% --- Outputs from this function are returned to the command line.
function varargout = VLGUI_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 EnterBtn.
function EnterBtn_Callback(hObject, eventdata, handles)
% hObject    handle to EnterBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
voiceLevelGUI;
delete(handles.OpenGUI);



% --- Executes on mouse press over figure background, over a disabled or
% --- inactive control, or over an axes background.
function OpenGUI_WindowButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to OpenGUI (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
get(gcf,'position');



% --- Executes on button press in ExitBtn.
function ExitBtn_Callback(hObject, eventdata, handles)
% hObject    handle to ExitBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
selection = questdlg(['退出 ' get(handles.OpenGUI,'Name') '?'],...
                     ['退出 ' get(handles.OpenGUI,'Name') '...'],...
                     '是','否','是');
if strcmp(selection,'否')
    return;
end
delete(handles.OpenGUI);



% --- Executes on button press in HelpBtn.
function HelpBtn_Callback(hObject, eventdata, handles)
% hObject    handle to HelpBtn (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% str={'对不起,目前尚未完成说明文件   ';' 打算尽快完善整个系统功能及使用说明  .'};
% msgbox(str,'使用帮助','help','non-modal');
!voiceLevelHelp.CHM