📄 detreeexp2.m
字号:
function varargout = DetreeExp2(varargin)
% DETREEEXP2 M-file for DetreeExp2.fig
% DETREEEXP2, by itself, creates a new DETREEEXP2 or raises the existing
% singleton*.
%
% H = DETREEEXP2 returns the handle to a new DETREEEXP2 or the handle to
% the existing singleton*.
%
% DETREEEXP2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in DETREEEXP2.M with the given input arguments.
%
% DETREEEXP2('Property','Value',...) creates a new DETREEEXP2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before DetreeExp2_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to DetreeExp2_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 DetreeExp2
% Last Modified by GUIDE v2.5 31-May-2006 08:12:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @DetreeExp2_OpeningFcn, ...
'gui_OutputFcn', @DetreeExp2_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 DetreeExp2 is made visible.
function DetreeExp2_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 DetreeExp2 (see VARARGIN)
% Choose default command line output for DetreeExp2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes DetreeExp2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = DetreeExp2_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)
DetreeExp2_1; %装载数据,作散点图.
global Text1 Text2 Text
T1='load car'
T2='gscatter(WM(:,1), WM(:,2), Model_Year)'
Text1 = strvcat(T1,T2)
set(handles.edit2,'String',Text1);
T3='装载car数据集'
T4='汽车属性-车重,里/加仑'
Text2 = strvcat(T3,T4);
set(handles.edit4,'String',Text2);
% 对按钮2进行操作--------------------------------------------------------------
function pushbutton2_Callback(hObject, eventdata, handles)
cla;
DetreeExp2_2
global Text1 Text2 Text
t1='linclass = classify(WM(:,1:2),WM(:,1:2),Model_Year);'
t2='bad = ~strcmp(linclass,Model_Year);'
t3='numobs = size(WM,1);'
t4='sum(bad) / numobs; ans=0.32'
Text1 = strvcat(t1,t2,t3,t4)
set(handles.edit2,'String',Text1);
set(handles.edit5,'String','32%');
t5='线性分类'
t6='计算错误分类比例'
t7=' ';
t8='可见用线性分类错误比例达32%'
Text2=strvcat(t5,t6,t7,t8)
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)
DtreeGUI2;
% --- Executes on button press in radiobutton1.
function radiobutton1_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton1 (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 radiobutton1
% --- Executes on button press in radiobutton2.
function radiobutton2_Callback(hObject, eventdata, handles)
% hObject handle to radiobutton2 (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 radiobutton2
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)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -