📄 detreeexp1.asv
字号:
function varargout = DetreeExp1(varargin)
% DETREEEXP1 M-file for DetreeExp1.fig
% DETREEEXP1, by itself, creates a new DETREEEXP1 or raises the existing
% singleton*.
%
% H = DETREEEXP1 returns the handle to a new DETREEEXP1 or the handle to
% the existing singleton*.
%
% DETREEEXP1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DETREEEXP1.M with the given input arguments.
%
% DETREEEXP1('Property','Value',...) creates a new DETREEEXP1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before DetreeExp1_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to DetreeExp1_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
% Copyright 2002-2003 The MathWorks, Inc.
% Edit the above text to modify the response to help DetreeExp1
% Last Modified by GUIDE v2.5 29-May-2006 13:15:44
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @DetreeExp1_OpeningFcn, ...
'gui_OutputFcn', @DetreeExp1_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 DetreeExp1 is made visible.
function DetreeExp1_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 DetreeExp1 (see VARARGIN)
% Choose default command line output for DetreeExp1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes DetreeExp1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = DetreeExp1_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;
%--------------------------------------------------------------------------
% GUI构件设置
%--------------------------------------------------------------------------
% 对按钮1进行操作--------------------------------------------------------------
function pushbutton1_Callback(hObject, eventdata, handles)
DetreeExp1_1; %装载数据,作散点图.
global Text1 Text2 Text
T1='load fisheriris'
T2='gscatter(meas(:,1), meas(:,2), species)'
Text1 = strvcat(T1,T2)
set(handles.edit2,'String',Text1);
T3='装载 fisheriris 数据集'
T4='我们只用包含萼片测量属性的两列'
Text2 = strvcat(T3,T4);
set(handles.edit4,'String',Text2);
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu1 (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
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (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 edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (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 pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles)
%打开帮助文件
helpwin(mfilename)
% --- Executes on button press in pushbutton21.
function pushbutton21_Callback(hObject, eventdata, handles)
%关闭对话框
close(gcf);
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (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 edit3 as text
% str2double(get(hObject,'String')) returns contents of edit3 as a double
% --- Executes during object creation, after setting all properties.
function edit3_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit3 (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 pushbutton23.
function pushbutton23_Callback(hObject, eventdata, handles)
DtreeGUI;
function edit4_Callback(hObject, eventdata, handles)
% hObject handle to edit4 (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 edit4 as text
% str2double(get(hObject,'String')) returns contents of edit4 as a double
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit4 (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 pushbutton24.
function pushbutton24_Callback(hObject, eventdata, handles)
cla;
DetreeExp1_2;
global Text1 Text2 Text
t1='quadclass = classify(meas(:,1:2),meas(:,1:2),species);'
t2='bad = ~strcmp(quadclass,species);'
t3='numobs = size(meas,1);'
t4='sum(bad) / numobs;'
t5='ans=0.2'
Text1 = strvcat(t1,t2,t3,t4,t5)
set(handles.edit2,'String',Text1);
set(handles.edit5,'String','20%');
t5='用二次方程分类计算错误分类比例'
t6='可见用二次方程分类错误比例达20%'
Text2=strvcat(t5,t6)
set(handles.edit4,'String',Text2);
% --- Executes on button press in pushbutton26.
function pushbutton26_Callback(hObject, eventdata, handles)
cla;
DetreeExp1_3;
global Text1 Text2 Text
t1='[x,y] = meshgrid(4:.1:8,2:.1:4.5);'
t2='x = x(:);'
t3='y = y(:);'
t4='j = classify([x y],meas(:,1:2),species);'
t5='gscatter(x,y,j);'
Text1 = strvcat(t1,t2,t3,t4,t5)
set(handles.edit2,'String',Text1);
t5='创建含有x轴,y轴的栅格图来显示这些区域,'
t6='并在栅格图栅上应用分类函数'
Text2=strvcat(t5,t6)
set(handles.edit4,'String',Text2);
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
global Text5
axes(handles.axes1);
popup_sel_index1 = get(handles.popupmenu2, 'Value');
switch popup_sel_index1
case 1 % axis on ;
Text5='axis on ';
case 2 % axis off ;
Text5='axis off ';
case 3 % axis ij;
Text5='axis ij ';
case 4 % axis xy;
Text5='axis xy';
end
eval(Text5);
set(handles.edit2,'String',Text5);
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (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
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --------------------------------------------------------------------
function matlab_H_Callback(hObject, eventdata, handles)
% hObject handle to matlab_H (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
helpwin();
% --------------------------------------------------------------------
function system_H_Callback(hObject, eventdata, handles)
% hObject handle to system_H (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
system
% --------------------------------------------------------------------
function author_C_Callback(hObject, eventdata, handles)
% hObject handle to author_C (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
about
% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_2_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Untitled_5_Callback(hObject, eventdata, handles)
% hObject handle to Untitled_5 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function Risk_Callback(hObject, eventdata, handles)
% hObject handle to Risk (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
DetreeExp5;
% --------------------------------------------------------------------
function exp2_Callback(hObject, eventdata, handles)
% hObject handle to exp2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
DetreeExp2;
% --------------------------------------------------------------------
function close_DE_Callback(hObject, eventdata, handles)
% hObject handle to close_DE (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close(gcf)
function edit5_Callback(hObject, eventdata, handles)
% hObject handle to edit5 (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 edit5 as text
% str2double(get(hObject,'String')) returns contents of edit5 as a double
% --- Executes during object creation, after setting all properties.
function edit5_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit5 (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
% --------------------------------------------------------------------
function ant_Callback(hObject, eventdata, handles)
% hObject handle to ant (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
DetreeExp3;
% --------------------------------------------------------------------
function balance_Callback(hObject, eventdata, handles)
% hObject handle to balance (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
DetreeExp4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -