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

📄 zhuo_se1_01.m

📁 初学者设计的matlab顶点问题着色问题gui解决
💻 M
字号:
function varargout = zhuo_se1_01(varargin)
% ZHUO_SE1_01 M-file for zhuo_se1_01.fig
%      ZHUO_SE1_01, by itself, creates a new ZHUO_SE1_01 or raises the existing
%      singleton*.
%
%      H = ZHUO_SE1_01 returns the handle to a new ZHUO_SE1_01 or the handle to
%      the existing singleton*.
%
%      ZHUO_SE1_01('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in ZHUO_SE1_01.M with the given input arguments.
%
%      ZHUO_SE1_01('Property','Value',...) creates a new ZHUO_SE1_01 or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before zhuo_se1_01_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to zhuo_se1_01_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 zhuo_se1_01

% Last Modified by GUIDE v2.5 28-Mar-2009 19:38:50

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @zhuo_se1_01_OpeningFcn, ...
                   'gui_OutputFcn',  @zhuo_se1_01_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 zhuo_se1_01 is made visible.
function zhuo_se1_01_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no shu_chu 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 zhuo_se1_01 (see VARARGIN)

% Choose default command line shu_chu for zhuo_se1_01
handles.shu_chu = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes zhuo_se1_01 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
axis('off');

% --- Outputs from this function are returned to the command line.
function varargout = zhuo_se1_01_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning shu_chu 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 shu_chu from handles structure
varargout{1} = handles.shu_chu;



% --- Executes on button press in preview.
function preview_Callback(hObject, eventdata, handles)
% hObject    handle to preview (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 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)


% --- 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)


function point_Callback(hObject, eventdata, handles)
% hObject    handle to point (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 point as text
%        str2double(get(hObject,'String')) returns contents of point as a double

n=str2double(get(hObject,'String'));
sp_n_s = 0.05;%space between point and text
t=linspace(2*pi,0,n+1);
P=[sin(t);cos(t)];
scatter(P(1,:),P(2,:),50,'r','filled');
for i=1:n
    stri=int2str(i);
    text(P(1,i)+sp_n_s,P(2,i),stri);
end
axis('off');
A = zeros(n);
handles.A=A;
handles.P=P;
keyboard

% --- Executes during object creation, after setting all properties.
function point_CreateFcn(hObject, eventdata, handles)
% hObject    handle to point (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.
n=str2double(get(hObject,'String'));
sp_n_s = 0.05;%space between point and text
t=linspace(2*pi,0,n+1);
P=[sin(t);cos(t)];
scatter(P(1,:),P(2,:),50,'r','filled');
for i=1:n
    stri=int2str(i);
    text(P(1,i)+sp_n_s,P(2,i),stri);
end
axis('off');
A = zeros(n);
handles.A=A;
handles.P=P;

if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
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
keyboard
joint1 = str2double(get(hObject,'String'));
handles.joint1=joint1;
keyboard
set(handles.edit6,'String',num2str(handles.A));
keyboard

% --- 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.
keyboard
joint1 = str2double(get(hObject,'String'));
handles.joint1=joint1;
keyboard
set(handles.edit6,'String',num2str(handles.A));
keyboard

if ispc
    set(hObject,'BackgroundColor','white');
else
    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end



function colour_Callback(hObject, eventdata, handles)
% hObject    handle to colour (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 colour as text
%        str2double(get(hObject,'String')) returns contents of colour as a double


% --- Executes during object creation, after setting all properties.
function colour_CreateFcn(hObject, eventdata, handles)
% hObject    handle to colour (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
joint2 = str2double(get(hObject,'String'));
handles.joint2=joint2;
handles.A(handles.joint1,handles.joint2) = 1;
handles.A(handles.joint2,handles.joint1) = 1;

% --- 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 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 edit6_Callback(hObject, eventdata, handles)
% hObject    handle to edit6 (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 edit6 as text
%        str2double(get(hObject,'String')) returns contents of edit6 as a double


% --- Executes during object creation, after setting all properties.
function edit6_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit6 (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 + -