⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_cluster.m

📁 聚类算法,绝对值距离且比雪夫距离平均值距离等.matlab程序,GUI界面,有详细说明
💻 M
📖 第 1 页 / 共 2 页
字号:
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_15_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_15 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_11_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_11 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



%$$$$$$$$$$$$$$$$$$ 最终类别数 $$$$$$$$$$$$$$$$$$$$$
function lei_num_Callback(hObject, eventdata, handles)
% hObject    handle to lei_num (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%###################
%以字符串的形式来存储数据文本框1的内容. 如果字符串不是数字,则现实空白内容
input = str2num(get(hObject,'String'));
%检查输入是否为空. 如果为空,则默认显示为3
if (isempty(input))
     get(hObject,'String','3')
end
guidata(hObject, handles);
%#########################

% Hints: get(hObject,'String') returns contents of lei_num as text
%        str2double(get(hObject,'String')) returns contents of lei_num as a double


% --- Executes during object creation, after setting all properties.
function lei_num_CreateFcn(hObject, eventdata, handles)
% hObject    handle to lei_num (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 pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_17_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_17 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_18_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_18 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_19_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_19 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_20_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_20 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


% --------------------------------------------------------------------
function Untitled_16_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_16 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)





function train_file_loc_Callback(hObject, eventdata, handles)
% hObject    handle to train_file_loc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%###### 输入训练文件的位置 ###
file_loc=get(hObject,'String');
if (isempty(file_loc))
     get(hObject,'String','C:\user\William\Documents\MATLAB\JULEI\irisdata_train.xls');
end
guidata(hObject, handles);
%##################
% Hints: get(hObject,'String') returns contents of train_file_loc as text
%        str2double(get(hObject,'String')) returns contents of train_file_loc as a double


% --- Executes during object creation, after setting all properties.
function train_file_loc_CreateFcn(hObject, eventdata, handles)
% hObject    handle to train_file_loc (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 rec_file_loc_Callback(hObject, eventdata, handles)
% hObject    handle to rec_file_loc (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%###### 输入测试文件的位置 ###
file_loc=get(hObject,'String');
if (isempty(file_loc))
     get(hObject,'String','C:\user\William\Documents\MATLAB\JULEI\irisdata_reco.xls');
end
guidata(hObject, handles);
%##################
% Hints: get(hObject,'String') returns contents of rec_file_loc as text
%        str2double(get(hObject,'String')) returns contents of rec_file_loc as a double


% --- Executes during object creation, after setting all properties.
function rec_file_loc_CreateFcn(hObject, eventdata, handles)
% hObject    handle to rec_file_loc (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 pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (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 browse.
function browse_Callback(hObject, eventdata, handles)
% hObject    handle to browse (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%###############自己填写的
handles.file_loc=xlsread(uigetfile('*.xls'));
bcb=handles.file_loc;
guidata(hObject,handles);
set(gcf,'CurrentAxes',handles.axes2);
plot(bcb(1:20,3),bcb(1:20,4),'r*',bcb(21:40,3),bcb(21:40,4),'b*',bcb(41:60,3),bcb(41:60,4),'g*');
%title('原始第一第二数据分布');


% --- Executes on selection change in popupmenu5.
function popupmenu5_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu5 (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 popupmenu5 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu5


% --- Executes during object creation, after setting all properties.
function popupmenu5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu5 (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 cha_num_Callback(hObject, eventdata, handles)
% hObject    handle to cha_num (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

%###################
%以字符串的形式来存储数据文本框的内容. 如果字符串不是数字,则现实空白内容
input=str2num(get(hObject,'String'));
%检查输入是否为空. 如果为空,则默认显示为3
if (isempty(input))
     get(hObject,'String','3')
end
guidata(hObject, handles);

% Hints: get(hObject,'String') returns contents of cha_num as text
%        str2double(get(hObject,'String')) returns contents of cha_num as a double


% --- Executes during object creation, after setting all properties.
function cha_num_CreateFcn(hObject, eventdata, handles)
% hObject    handle to cha_num (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 yang_3D.
function yang_3D_Callback(hObject, eventdata, handles)
% hObject    handle to yang_3D (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)


figure
plot3(handles.file_loc(1:20,3),handles.file_loc(1:20,4),handles.file_loc(1:20,5),'r*',handles.file_loc(21:40,3),handles.file_loc(21:40,4),handles.file_loc(21:40,5),'b*',handles.file_loc(41:60,3),handles.file_loc(41:60,4),handles.file_loc(41:60,5),'g*');
title('原始数据前三特征的三维分布');
grid;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -