gusucode.com > 《精通matlab 7》包括配套光盘 > 配套光盘里的程序附件/Ex-29/ex2901.m
function varargout = ex2901(varargin) % EX2901 M-file for ex2901.fig % EX2901, by itself, creates a new EX2901 or raises the existing % singleton*. % % H = EX2901 returns the handle to a new EX2901 or the handle to % the existing singleton*. % % EX2901('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in EX2901.M with the given input arguments. % % EX2901('Property','Value',...) creates a new EX2901 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before ex2901_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to ex2901_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 ex2901 % Last Modified by GUIDE v2.5 03-Apr-2006 00:00:00 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @ex2901_OpeningFcn, ... 'gui_OutputFcn', @ex2901_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 ex2901 is made visible. function ex2901_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 ex2901 (see VARARGIN) % Choose default command line output for ex2901 handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes ex2901 wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = ex2901_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 on button press in radioflat. function radioflat_Callback(hObject, eventdata, handles) % hObject handle to radioflat (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 radioflat set(hObject,'Value',get(hObject,'Max')) set(findobj(gcf,'Tag','radiointerp'),'Value',... get(findobj(gcf,'Tag','radiointerp'),'Min')) set(findobj(gcf,'Tag','radiofaceted'),'Value',... get(findobj(gcf,'Tag','radiofaceted'),'Min')) % --- Executes on button press in radiointerp. function radiointerp_Callback(hObject, eventdata, handles) % hObject handle to radiointerp (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 radiointerp set(hObject,'Value',get(hObject,'Max')) set(findobj(gcf,'Tag','radioflat'),'Value',... get(findobj(gcf,'Tag','radioflat'),'Min')) set(findobj(gcf,'Tag','radiofaceted'),'Value',... get(findobj(gcf,'Tag','radiofaceted'),'Min')) % --- Executes on button press in radiofaceted. function radiofaceted_Callback(hObject, eventdata, handles) % hObject handle to radiofaceted (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 radiofaceted set(hObject,'Value',get(hObject,'Max')) set(findobj(gcf,'Tag','radioflat'),'Value',... get(findobj(gcf,'Tag','radioflat'),'Min')) set(findobj(gcf,'Tag','radiointerp'),'Value',... get(findobj(gcf,'Tag','radiointerp'),'Min')) % --- Executes on button press in buttonsurf. function buttonsurf_Callback(hObject, eventdata, handles) % hObject handle to buttonsurf (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) hrf=findobj(gcf,'Tag','radioflat'); hri=findobj(gcf,'Tag','radiointerp'); hrc=findobj(gcf,'Tag','radiofaceted'); set(gcf,'CurrentAxes',findobj(gcf,'Type','Axes')) ezsurf(@peaks) if(get(hrf,'Value')==get(hrf,'Max')) shading flat elseif(get(hri,'Value')==get(hri,'Max')) shading interp elseif(get(hrc,'Value')==get(hrc,'Max')) shading faceted end % --- Executes on button press in buttonclf. function buttonclf_Callback(hObject, eventdata, handles) % hObject handle to buttonclf (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) clf % -------------------------------------------------------------------- function mnsurf_Callback(hObject, eventdata, handles) % hObject handle to mnsurf (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) buttonsurf_Callback() % -------------------------------------------------------------------- function mncla_Callback(hObject, eventdata, handles) % hObject handle to mncla (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) cla % -------------------------------------------------------------------- function mnclose_Callback(hObject, eventdata, handles) % hObject handle to mnclose (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close % -------------------------------------------------------------------- function mncontrol_Callback(hObject, eventdata, handles) % hObject handle to mncontrol (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)