function varargout = myjob(varargin)
% MYJOB M-file for myjob.fig
% MYJOB, by itself, creates a new MYJOB or raises the existing
% singleton*.
%
% H = MYJOB returns the handle to a new MYJOB or the handle to
% the existing singleton*.
%
% MYJOB('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MYJOB.M with the given input arguments.
%
% MYJOB('Property','Value',...) creates a new MYJOB or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before myjob_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to myjob_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 myjob
% Last Modified by GUIDE v2.5 21-Dec-2011 19:38:58
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @myjob_OpeningFcn, ...
'gui_OutputFcn', @myjob_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 myjob is made visible.
function myjob_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 myjob (see VARARGIN)
global glo
glo=0
% Choose default command line output for myjob
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes myjob wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = myjob_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 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)
global glo
glo=glo+1
tmp=get(findobj(gcf,'tag','popupmenu4'),'value')
switch tmp
case 1
[X,Y,Z]=peaks(30);
mesh(X,Y,Z)
case 2
pie3([1 2 3 2.5 2],[0 1 0 1 0])
case 3
[x y]=meshgrid(-3:.5:3,-3:.1:3)
z=peaks(x,y)
ribbon(y,z)
case 4
sphere(15)
case 5
t=0:pi/20:2*pi
[X Y Z]=cylinder(2+sin(t).*cos(t))
surf(X,Y,Z)
end
hpb2=findobj(gcf,'tag','pushbutton2')
hs1=findobj(gcf,'tag','pushbutton3')
hs2=findobj(gcf,'tag','pushbutton4')
if rem(glo,2)
set(hpb2,'visible','on')
set(hs1,'visible','off')
set(hs2,'visible','off')
else
set(hpb2,'visible','off')
set(hs1,'visible','on')
set(hs2,'visible','on')
end
set(findobj(gcf,'tag','pushbutton6'),'visible','on')
set(findobj(gcf,'tag','edit2'),'visible','on')
set(findobj(gcf,'tag','edit3'),'visible','on')
set(findobj(gcf,'tag','pushbutton1'),'string','chang mod')
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (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,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
set(hObject,'BackgroundColor',[.9 .9 .9]);
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on slider movement.
function slider2_Callback(hObject, eventdata, handles)
% hObject handle to slider2 (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,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
% --- Executes during object creation, after setting all properties.
function slider2_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background, change
% 'usewhitebg' to 0 to use default. See ISPC and COMPUTER.
usewhitebg = 1;
if usewhitebg
set(hObject,'BackgroundColor',[.9 .9 .9]);
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));
end
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(findobj(gcf,'tag','pushbutton1'),'visible','off')
set(findobj(gcf,'tag','pushbutton2'),'visible','off')
set(findobj(gcf,'tag','pushbutton6'),'visible','off')
set(findobj(gcf,'tag','edit2'),'visible','off')
set(findobj(gcf,'tag','edit3'),'visible','off')
set(findobj(gcf,'tag','slider3'),'visible','off')
set(findobj(gcf,'tag','slider4'),'visible','off')
el=30;
for az=0:5:360
view(az,el);
drawnow;
end
az= 30;
for el=0:5:360
view(az,el);
drawnow;
end
set(findobj(gcf,'tag','pushbutton1'),'visible','on')
set(findobj(gcf,'tag','pushbutton2'),'visible','on')
set(findobj(gcf,'tag','pushbutton6'),'visible','on')
set(findobj(gcf,'tag','edit2'),'visible','on')
set(findobj(gcf,'tag','edit3'),'visible','on')
set(findobj(gcf,'tag','slider3'),'visible','on')
set(findobj(gcf,'tag','slider4'),'visible','on')
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (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 edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (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
- 1
- 2
前往页