📄 detreeexp1.m
字号:
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 20:31:38
% 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);
% --- 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)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -