📄 lab1.m
字号:
function varargout = lab1(varargin)
% LAB1 M-file for lab1.fig
% LAB1, by itself, creates a new LAB1 or raises the existing
% singleton*.
%
% H = LAB1 returns the handle to a new LAB1 or the handle to
% the existing singleton*.
%
% LAB1('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in LAB1.M with the given input arguments.
%
% LAB1('Property','Value',...) creates a new LAB1 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before lab1_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to lab1_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 lab1
% Last Modified by GUIDE v2.5 26-Apr-2005 11:20:04
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @lab1_OpeningFcn, ...
'gui_OutputFcn', @lab1_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 lab1 is made visible.
function lab1_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 lab1 (see VARARGIN)
% Choose default command line output for lab1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes lab1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
%绘制界面中镂空图
[x,y]=meshgrid(-3:1/8:3);
z=peaks(x,y);
surfl(x,y,z);
shading interp
hold on
mesh(x,y,z)
colormap copper
axis([-3 3 -3 3 -8 8])
axis off
%设置当前窗口背景颜色
set(gcf,'color',[1,0.98,0.9])
% --- Outputs from this function are returned to the command line.
function varargout = lab1_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)
%设置当前窗口名
str='根轨迹分析实验窗口';
set(gcf,'name',str,'numbertitle','off');
% Get default command line output from handles structure
varargout{1} = handles.output;
% --------------------------------------------------------------------function aim_Callback(hObject, eventdata, handles)% hObject handle to Untitled_1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)aim% --------------------------------------------------------------------function context_Callback(hObject, eventdata, handles)% hObject handle to context (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)context% --------------------------------------------------------------------function thinking_Callback(hObject, eventdata, handles)% hObject handle to thinking (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)think% --------------------------------------------------------------------function quit_Callback(hObject, eventdata, handles)% hObject handle to quit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function exit_Callback(hObject, eventdata, handles)% hObject handle to exit (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
%设置关闭提示对话框button=questdlg('Do you want to close this window?',...
'Close Operation','Yes','No','No');
if strcmp(button,'Yes')
close
elseif strcmp(button,'No')
disp('Canceled file operation')
end% --------------------------------------------------------------------function quit_matlab_Callback(hObject, eventdata, handles)% hObject handle to quit_matlab (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
%设置退出matlab提示对话框button=questdlg('Do you want to quit?',...
'Quit Operation','Yes','No','No');
if strcmp(button,'Yes')
quit
elseif strcmp(button,'No')
disp('Canceled file operation')
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -