程序:
function varargout = yinpin(varargin) % YINPIN M-file for yinpin.fig
% YINPIN, by itself, creates a new YINPIN or raises the existing % singleton*. %
% H = YINPIN returns the handle to a new YINPIN or the handle to % the existing singleton*. %
% YINPIN('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in YINPIN.M with the given input arguments. %
% YINPIN('Property','Value',...) creates a new YINPIN or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before yinpin_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to yinpin_OpeningFcn via varargin. %
% *See GUI Options on GUIDE's Tools menu. Choose \ % instance to run (singleton)\ %
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help yinpin
% Last Modified by GUIDE v2.5 07-Nov-2012 17:08:53
% Begin initialization code - DO NOT EDIT gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @yinpin_OpeningFcn, ... 'gui_OutputFcn', @yinpin_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
% --- Executes just before yinpin is made visible.
function yinpin_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 yinpin (see VARARGIN)
% Choose default command line output for yinpin handles.output = hObject;
5 / 21
% Update handles structure guidata(hObject, handles);
% UIWAIT makes yinpin wait for user response (see UIRESUME) % uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line. function varargout = yinpin_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 during object creation, after setting all properties. function edit1_CreateFcn(hObject, eventdata, handles) % hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes during object creation, after setting all properties. function caiyangpinlv_CreateFcn(hObject, eventdata, handles) % hObject handle to caiyangpinlv (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes during object creation, after setting all properties. function caiyangdianshu_CreateFcn(hObject, eventdata, handles) % hObject handle to caiyangdianshu (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in luyin.
function luyin_Callback(hObject, eventdata, handles) % hObject handle to luyin (see GCBO)
6 / 21
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of luyin set(handles.luyin,'value',1); set(handles.wavfile,'value',0);
set(handles.xinhaofasheng,'value',0); h=findobj('Tag','recordtime'); set(h,'enable','on');
h=findobj('Tag','kaishiluyin'); set(h,'enable','on');
h=findobj('Tag','wavname'); set(h,'enable','off');
h=findobj('Tag','liulan'); set(h,'enable','off');
h=findobj('Tag','inwave'); set(h,'enable','off');
h=findobj('Tag','infudu'); set(h,'enable','off'); h=findobj('Tag','infre'); set(h,'enable','off');
h=findobj('Tag','inphase'); set(h,'enable','off'); h=findobj('Tag','mix'); set(h,'enable','off');
h=findobj('Tag','shengchengboxing'); set(h,'enable','off');
% --- Executes on button press in wavfile.
function wavfile_Callback(hObject, eventdata, handles) % hObject handle to wavfile (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of wavfile set(handles.luyin,'value',0); set(handles.wavfile,'value',1);
set(handles.xinhaofasheng,'value',0); h=findobj('Tag','recordtime'); set(h,'enable','off');
h=findobj('Tag','kaishiluyin'); set(h,'enable','off');
h=findobj('Tag','wavname'); set(h,'enable','on');
h=findobj('Tag','liulan'); set(h,'enable','on');
h=findobj('Tag','inwave'); set(h,'enable','off');
h=findobj('Tag','infudu'); set(h,'enable','off'); h=findobj('Tag','infre'); set(h,'enable','off');
h=findobj('Tag','inphase'); set(h,'enable','off'); h=findobj('Tag','mix'); set(h,'enable','off');
7 / 21
h=findobj('Tag','shengchengboxing'); set(h,'enable','off');
% --- Executes on button press in xinhaofasheng.
function xinhaofasheng_Callback(hObject, eventdata, handles) % hObject handle to xinhaofasheng (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of xinhaofasheng set(handles.luyin,'value',0); set(handles.wavfile,'value',0);
set(handles.xinhaofasheng,'value',1); h=findobj('Tag','recordtime'); set(h,'enable','off');
h=findobj('Tag','kaishiluyin'); set(h,'enable','off');
h=findobj('Tag','wavname'); set(h,'enable','off');
h=findobj('Tag','liulan'); set(h,'enable','off');
h=findobj('Tag','inwave'); set(h,'enable','on');
h=findobj('Tag','infudu'); set(h,'enable','on'); h=findobj('Tag','infre'); set(h,'enable','on');
h=findobj('Tag','inphase'); set(h,'enable','on'); h=findobj('Tag','mix'); set(h,'enable','on');
h=findobj('Tag','shengchengboxing'); set(h,'enable','on');
% --- Executes during object creation, after setting all properties. function recordtime_CreateFcn(hObject, eventdata, handles) % hObject handle to recordtime (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in kaishiluyin.
function kaishiluyin_Callback(hObject, eventdata, handles) % hObject handle to kaishiluyin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of kaishiluyin Fs=str2double(get(handles.caiyangpinlv,'String')); N=str2double(get(handles.recordtime,'String'))*Fs; handles.y=wavrecord(N, Fs,'double'); handles.inputtype=1;
8 / 21
guidata(hObject,handles);
plot(handles.fenxiduixiang,handles.y); ysize=size(handles.y);
set(handles.caiyangdianshu,'String',num2str(ysize(1)));
% --- Executes during object creation, after setting all properties. function wavname_CreateFcn(hObject, eventdata, handles) % hObject handle to wavname (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes on button press in liulan.
function liulan_Callback(hObject, eventdata, handles) % hObject handle to liulan (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of liulan [filename,filepath]=uigetfile('*.wav','wavfile'); set(handles.wavname,'string',filename); [handles.y,Fs,bit]=wavread(filename); handles.inputtype=2; guidata(hObject,handles);
plot(handles.fenxiduixiang,(1:length(handles.y)/10)/Fs,handles.y(1:length(handles.y)/10)); ysize=size(handles.y);
set(handles.caiyangdianshu,'String',num2str(ysize(1))); set(handles.caiyangpinlv,'string',Fs);
% --- Executes during object creation, after setting all properties. function listbox2_CreateFcn(hObject, eventdata, handles) % hObject handle to listbox2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: listbox controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
% --- Executes during object creation, after setting all properties. function inwave_CreateFcn(hObject, eventdata, handles) % hObject handle to inwave (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) set(hObject,'BackgroundColor','white'); end
9 / 21
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库数字信号处理实验8音频频谱分析仪设计与实现(2)在线全文阅读。
相关推荐: