📄 test.m
字号:
function varargout = test(varargin)%TEST M-file for test.fig% TEST, by itself, creates a new TEST or raises the existing% singleton*.%% H = TEST returns the handle to a new TEST or the handle to% the existing singleton*.%% TEST('Property','Value',...) creates a new TEST using the% given property value pairs. Unrecognized properties are passed via% varargin to test_OpeningFcn. This calling syntax produces a% warning when there is an existing singleton*.%% TEST('CALLBACK') and TEST('CALLBACK',hObject,...) call the% local function named CALLBACK in TEST.M with the given input% arguments.%% *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 test% Last Modified by GUIDE v2.5 14-Sep-2006 14:12:05% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @test_OpeningFcn, ... 'gui_OutputFcn', @test_OutputFcn, ... 'gui_LayoutFcn', [], ... 'gui_Callback', []);if nargin && ischar(varargin{1}) gui_State.gui_Callback = str2func(varargin{1});endif 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 test is made visible.function test_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 unrecognized PropertyName/PropertyValue pairs from the% command line (see VARARGIN)% Choose default command line output for testhandles.output = hObject;% Update handles structureguidata(hObject, handles);%[y,fs,nbits]=wavread('start');%wavplay(y,fs);% UIWAIT makes test wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = test_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 structurevarargout{1} = handles.output;function a6_edit_Callback(hObject, eventdata, handles)% hObject handle to a6_edit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of a6_edit as text% str2double(get(hObject,'String')) returns contents of a6_edit as a double% --- Executes during object creation, after setting all properties.function a6_edit_CreateFcn(hObject, eventdata, handles)% hObject handle to a6_edit (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction a5_edit_Callback(hObject, eventdata, handles)% hObject handle to a5_edit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of a5_edit as text% str2double(get(hObject,'String')) returns contents of a5_edit as a double% --- Executes during object creation, after setting all properties.function a5_edit_CreateFcn(hObject, eventdata, handles)% hObject handle to a5_edit (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction a4_edit_Callback(hObject, eventdata, handles)% hObject handle to a4_edit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of a4_edit as text% str2double(get(hObject,'String')) returns contents of a4_edit as a double% --- Executes during object creation, after setting all properties.function a4_edit_CreateFcn(hObject, eventdata, handles)% hObject handle to a4_edit (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction a3_edit_Callback(hObject, eventdata, handles)% hObject handle to a3_edit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of a3_edit as text% str2double(get(hObject,'String')) returns contents of a3_edit as a double% --- Executes during object creation, after setting all properties.function a3_edit_CreateFcn(hObject, eventdata, handles)% hObject handle to a3_edit (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction a2_edit_Callback(hObject, eventdata, handles)% hObject handle to a2_edit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of a2_edit as text% str2double(get(hObject,'String')) returns contents of a2_edit as a double% --- Executes during object creation, after setting all properties.function a2_edit_CreateFcn(hObject, eventdata, handles)% hObject handle to a2_edit (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction a1_edit_Callback(hObject, eventdata, handles)% hObject handle to a1_edit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of a1_edit as text% str2double(get(hObject,'String')) returns contents of a1_edit as a double% --- Executes during object creation, after setting all properties.function a1_edit_CreateFcn(hObject, eventdata, handles)% hObject handle to a1_edit (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction a0_edit_Callback(hObject, eventdata, handles)% hObject handle to a0_edit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of a0_edit as text% str2double(get(hObject,'String')) returns contents of a0_edit as a double% --- Executes during object creation, after setting all properties.function a0_edit_CreateFcn(hObject, eventdata, handles)% hObject handle to a0_edit (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% function axes1_Callback(hObject, eventdata, handles)% --- Executes on button press in ok2.function ok2_Callback(hObject, eventdata, handles) %---- ok2's callback function a0=str2num(get(handles.a0_edit,'string')); % get a(i0a1=str2num(get(handles.a1_edit,'string'));a2=str2num(get(handles.a2_edit,'string'));a3=str2num(get(handles.a3_edit,'string'));a4=str2num(get(handles.a4_edit,'string'));a5=str2num(get(handles.a5_edit,'string'));a6=str2num(get(handles.a6_edit,'string'));n=str2num(get(handles.edit9,'string')); % get nset(handles.is_text11,'enable','on');set(handles.isnot_text12,'enable','on');set(handles.text18,'enable','on');guidata(hObject, handles);[y,p,t]=hw(n,a0,a1,a2,a3,a4,a5,a6); % call the function 'hw'y=y';y=num2str(y);set(handles.text19,'string',['The roots: ',y]);set(handles.input_x_text13,'string',['!!! You input: ',p]);if t==1 set(handles.isnot_text12,'string',' is ');else set(handles.isnot_text12,'string','is not');endset(handles.text20,'string','Please see the result!'); % give the result !guidata(hObject, handles);% hObject handle to ok2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --- Executes on button press in ok1.function ok1_Callback(hObject, eventdata, handles) % ok1's callback function v1=get(handles.edit9,'string');set(handles.input_n_text9,'string',['!!! You input n=',v1]);set(handles.ok2,'enable','on');guidata(hObject, handles);n=str2num(get(handles.edit9,'string'));if n<6 set(handles.a6_edit,'enable','off'); set(handles.text1,'enable','off');endif n<5 set(handles.a5_edit,'enable','off'); set(handles.text2,'enable','off');endif n<4 set(handles.a4_edit,'enable','off'); set(handles.text3,'enable','off');endif n<3 set(handles.a3_edit,'enable','off'); set(handles.text4,'enable','off');endif n>6 | n<2 set(handles.edit9,'string',''); set(handles.a6_edit,'enable','on'); set(handles.text1,'enable','on'); set(handles.a5_edit,'enable','on'); set(handles.text2,'enable','on'); set(handles.a4_edit,'enable','on'); set(handles.text3,'enable','on'); set(handles.a3_edit,'enable','on'); set(handles.text4,'enable','on'); % [y,fs,nbits]=wavread('over'); % wavplay(y,fs); errordlg({'ERROR: You inputed a wrong N!','Tyr again.'},'Error');endguidata(hObject, handles);% hObject handle to ok1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)function edit9_Callback(hObject, eventdata, handles)% hObject handle to edit9 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of edit9 as text% str2double(get(hObject,'String')) returns contents of edit9 as a double% --- Executes during object creation, after setting all properties.function edit9_CreateFcn(hObject, eventdata, handles)% hObject handle to edit9 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on button press in quit.function quit_Callback(hObject, eventdata, handles)%[y,fs,nbits]=wavread('over');%wavplay(y,fs);% warndlg({'WARNING: You will close this window!'},'Warning')close(gcf);% hObject handle to quit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --- Executes on button press in clear.function clear_Callback(hObject, eventdata, handles) % clear's callback functionset(handles.edit9,'string','');set(handles.a0_edit,'string','');set(handles.a1_edit,'string','');set(handles.a2_edit,'string','');set(handles.a3_edit,'string','');set(handles.a4_edit,'string','');set(handles.a5_edit,'string','');set(handles.a6_edit,'string','');set(handles.input_n_text9,'string','!!! You input n=?');set(handles.input_x_text13,'string','!!! You input n=......');set(handles.is_text11,'enable','off');set(handles.isnot_text12,'enable','off');set(handles.text18,'enable','off');set(handles.text19,'string','');set(handles.ok2,'enable','off');guidata(hObject, handles);set(handles.a6_edit,'enable','on');set(handles.text1,'enable','on');set(handles.a5_edit,'enable','on');set(handles.text2,'enable','on');set(handles.a4_edit,'enable','on');set(handles.text3,'enable','on');set(handles.a3_edit,'enable','on');set(handles.text4,'enable','on');set(handles.text20,'string','Please input!');guidata(hObject, handles);% hObject handle to clear (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -