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

📄 draw_function_gui.m

📁 很好的图形编程
💻 M
字号:
function varargout = Draw_Function_GUI(varargin)
% DRAW_FUNCTION_GUI M-file for Draw_Function_GUI.fig
%      DRAW_FUNCTION_GUI, by itself, creates a new DRAW_FUNCTION_GUI or raises the existing
%      singleton*.
%
%      H = DRAW_FUNCTION_GUI returns the handle to a new DRAW_FUNCTION_GUI or the handle to
%      the existing singleton*.
%
%      DRAW_FUNCTION_GUI('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in DRAW_FUNCTION_GUI.M with the given input arguments.
%
%      DRAW_FUNCTION_GUI('Property','Value',...) creates a new DRAW_FUNCTION_GUI or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before Draw_Function_GUI_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to Draw_Function_GUI_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

% Edit the above text to modify the response to help Draw_Function_GUI

% Last Modified by GUIDE v2.5 20-Oct-2003 17:47:57
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @Draw_Function_GUI_OpeningFcn, ...
                   'gui_OutputFcn',  @Draw_Function_GUI_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(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 Draw_Function_GUI is made visible.
function Draw_Function_GUI_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 Draw_Function_GUI (see VARARGIN)

% Choose default command line output for Draw_Function_GUI
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes Draw_Function_GUI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = Draw_Function_GUI_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;
% --- Executes during object creation, after setting all properties.function listbox1_CreateFcn(hObject, eventdata, handles)% hObject    handle to listbox1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns called% Hint: listbox 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 selection change in listbox1.function listbox1_Callback(hObject, eventdata, handles)% hObject    handle to listbox1 (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 listbox1 contents as cell array%        contents{get(hObject,'Value')} returns selected item from listbox1num=get(gcbo,'Value');
Fig_UserData=get(gcf,'UserData');
Fig_UserData(1)=num;
set(gcf,'UserData',Fig_UserData);
%设置当前变化了绘制图形定义值
isYnHold=get(findobj(gcf,'Tag','Chexkbox3'),'Value');
%获取当前hold的情况
Run_Draw(Fig_UserData,isYnHold);function pushbutton2_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)close;% --- Executes during object creation, after setting all properties.function figure1_CreateFcn(hObject, eventdata, handles)% hObject    handle to figure1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    empty - handles not created until after all CreateFcns calledset(gcf,'UserData',[1 1 1 1 0 1 0])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 popupmenu1num=get(gcbo,'Value');
Fig_UserData=get(gcf,'UserData');
Fig_UserData(2)=num;
set(gcf,'UserData',Fig_UserData);
isYnHold=get(findobj(gcf,'Tag','Chexkbox3'),'Value');
Run_Draw(Fig_UserData,isYnHold);% --- Executes on selection change in popupmenu2.function popupmenu2_Callback(hObject, eventdata, handles)% hObject    handle to popupmenu2 (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 popupmenu2 contents as cell array%        contents{get(hObject,'Value')} returns selected item from popupmenu2num=get(gcbo,'Value');
Fig_UserData=get(gcf,'UserData');
Fig_UserData(3)=num;
set(gcf,'UserData',Fig_UserData);
isYnHold=get(findobj(gcf,'Tag','Chexkbox3'),'Value');
Run_Draw(Fig_UserData,isYnHold);% --- Executes on selection change in popupmenu3.function popupmenu3_Callback(hObject, eventdata, handles)% hObject    handle to popupmenu3 (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 popupmenu3 contents as cell array%        contents{get(hObject,'Value')} returns selected item from popupmenu3num=get(gcbo,'Value');
Fig_UserData=get(gcf,'UserData');
Fig_UserData(4)=num;
set(gcf,'UserData',Fig_UserData);
isYnHold=get(findobj(gcf,'Tag','Chexkbox3'),'Value');
Run_Draw(Fig_UserData,isYnHold);% --- Executes on button press in checkbox1.function checkbox1_Callback(hObject, eventdata, handles)% hObject    handle to checkbox1 (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 checkbox1
Fig_UserData=get(gcf,'UserData');if get(gcbo,'Value')==1 
    grid on
else
    grid off
end;
Fig_UserData(5)=get(gcbo,'Value');
set(gcf,'UserData',Fig_UserData);% --- Executes on button press in checkbox2.function checkbox2_Callback(hObject, eventdata, handles)% hObject    handle to checkbox2 (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 checkbox2
Fig_UserData=get(gcf,'UserData');if get(gcbo,'Value')==1 
    axis on
else
    axis off
end;
Fig_UserData(6)=get(gcbo,'Value');
set(gcf,'UserData',Fig_UserData);% --- Executes on button press in checkbox3.function checkbox3_Callback(hObject, eventdata, handles)% hObject    handle to checkbox3 (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 checkbox3
Fig_UserData=get(gcf,'UserData');if get(gcbo,'Value')==1 
    hold on;
    if Fig_UserData(1)>4   
        hold off;
        set(gcbo,'Value',0);
    end
else
    hold off
end;
Fig_UserData(7)=get(gcbo,'Value');
set(gcf,'UserData',Fig_UserData);% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton1 (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)title(get(findobj(gcf,'Tag','edit1'),'String'));
%只对添加这次事件有效

⌨️ 快捷键说明

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