📄 zhuo_se_1_02.m
字号:
end
function Join1_Callback(hObject, eventdata, handles)
% hObject handle to Join1 (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 Join1 as text
% str2double(get(hObject,'String')) returns contents of Join1 as a double
global JOINT1;
global NPOINT;
JOINT1=str2double(get(hObject,'String'));
is_zheng = mod(JOINT1,1);%judge whether zhengshu
if NPOINT == 0
msgbox('Please input the number of total point first!','Wrong','error');
elseif (JOINT1 > NPOINT)|(JOINT1<0)
msgbox('The number you input must less the number of total points!','Wrong','error');
set(handles.Join1,'String','');
JOINT1=0;
elseif (JOINT1 < 1)|(JOINT1 == NaN)|(is_zheng~=0)
msgbox('You must input a positive integer!','Wrong input','error');
set(handles.Join1,'String','');
JOINT1 = 0;
else
set(handles.join2,'String','');
end
% --- Executes during object creation, after setting all properties.
function Join1_CreateFcn(hObject, eventdata, handles)
% hObject handle to Join1 (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 join2_Callback(hObject, eventdata, handles)
% hObject handle to join2 (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 join2 as text
% str2double(get(hObject,'String')) returns contents of join2 as a double
global NPOINT;
global JOINT1;
global JOINT2;
global A;
global P;
if JOINT1==0
msgbox('Please input the number of the first point first!','Wrong','error');
end
if NPOINT == 0
msgbox('Please input the number of total point first!','Wrong','error');
end
JOINT2 = str2double(get(hObject,'String'));
is_zheng = mod(JOINT2,1);%judge whether zhengshu
if (JOINT2 > NPOINT) | (JOINT2 < 0)|(JOINT2 == NaN)
msgbox('The number you input must less the number of total points!','Wrong','error');
set(handles.join2,'String','');
elseif (JOINT2 < 1)|(JOINT2 == NaN)|(is_zheng~=0)
msgbox('You must input a positive integer','Wrong input','error');
set(handles.join2,'String','');
JOINT2 = 0;
elseif JOINT2==JOINT1
msgbox('You shoud input another number different from the first point you input','Wrong','error');
set(handles.join2,'String','');
else
A(JOINT1,JOINT2)=1;
A(JOINT2,JOINT1) = 1;
X=[P(1,JOINT1),P(1,JOINT2)];
Y=[P(2,JOINT1),P(2,JOINT2)];
plot(X,Y);
set(handles.Join1,'String','');
hold on;
end
% --- Executes during object creation, after setting all properties.
function join2_CreateFcn(hObject, eventdata, handles)
% hObject handle to join2 (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 ok.
function ok_Callback(hObject, eventdata, handles)
% hObject handle to ok (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Reset_Callback(handles.Reset, eventdata, handles);
set(handles.point,'String',8);
pause(1.5);
point_Callback(handles.point, eventdata, handles);
pause(2);
set(handles.colour,'String',9)
pause(1.5);
colour_Callback(handles.colour, eventdata, handles);
pause(1);
set(handles.Join1,'String',2);
Join1_Callback(handles.Join1, eventdata, handles);
pause(2);
set(handles.join2,'String',5);
join2_Callback(handles.join2, eventdata, handles);
pause(1);
set(handles.Join1,'String',4);
Join1_Callback(handles.Join1, eventdata, handles);
pause(2);
set(handles.join2,'String',6);
join2_Callback(handles.join2, eventdata, handles);
pause(1);
set(handles.Join1,'String',7);
Join1_Callback(handles.Join1, eventdata, handles);
pause(2);
set(handles.join2,'String',8);
join2_Callback(handles.join2, eventdata, handles);
%keyboard
% --- Executes on button press in Reset.
function Reset_Callback(hObject, eventdata, handles)
% hObject handle to Reset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global A;%the "juzhen"you want
global P;%the "zuobiao" of point
global NPOINT;%the total number of points
global JOINT1;%the first "dingdian"
global JOINT2;%the second "dingdian"
global NCOLOUR;%the number of colour
global RESULT;
global DUOXIANGSHI;
global FENJIE;
NPOINT = 0;
JOINT1 = 0;
JOINT2 = 0;
NCOLOUR = 0;
RESULT = 0;
set(handles.results,'String','');
set(handles.point,'String','');
set(handles.Join1,'String','');
set(handles.join2,'String','');
set(handles.colour,'String','');
axes(handles.axes1);
cla;
% --- Executes on button press in caculate.
function caculate_Callback(hObject, eventdata, handles)
% hObject handle to caculate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global A;
global NCOLOUR;
global NPOINT;
global RESULT;
global DUOXIANGSHI;
global FENJIE;
if NCOLOUR == 0| NPOINT == 0
msgbox('Please input the information above first!','Wrong','error');
%Reset_Callback(handles.Reset, eventdata, handles);
else
[DUOXIANGSHI,FENJIE,RESULT] = main(A,NCOLOUR);
shu_chu1 = ['The colour polynomial is n=',char(DUOXIANGSHI),'\nThe number of colouring method is ',num2str(RESULT)];
SHU_chu = sprintf(shu_chu1);
set(handles.results,'String',SHU_chu);
end
% --- Executes on button press in close.
function close_Callback(hObject, eventdata, handles)
% hObject handle to close (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clc;
clear all;
close(gcf);
function results_Callback(hObject, eventdata, handles)
% hObject handle to results (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 results as text
% str2double(get(hObject,'String')) returns contents of results as a double
% --- Executes during object creation, after setting all properties.
function results_CreateFcn(hObject, eventdata, handles)
% hObject handle to results (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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -