function varargout = rottest(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @rottest_OpeningFcn, ...
'gui_OutputFcn', @rottest_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
function rottest_OpeningFcn(hObject, eventdata, handles, varargin)
handles.output = hObject;
spy
MyTimer=timer('TimerFcn',@RotImgFcn,'BusyMode','queue','executionmode','fixedspacing','period',0.5);
set(MyTimer,'tag','MyTimer')
set(handles.axes1,'tag','MyAxes')
guidata(hObject, handles);
function varargout = rottest_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
function pushbutton1_Callback(hObject, eventdata, handles)
MyTimer=timerfind('tag','MyTimer');
MyTimerStatus=get(MyTimer,'Running');
if strcmp(MyTimerStatus,'off')
start(MyTimer)
else
stop(MyTimer)
end
function RotImgFcn(a,b)
camorbit(findall(0,'tag','MyAxes'),1,0,'data',[0 0 1]);
function figure1_CloseRequestFcn(hObject, eventdata, handles)
MyTimer=timerfind('tag','MyTimer');
MyTimerStatus=get(MyTimer,'Running');
if strcmp(MyTimerStatus,'on')
stop(MyTimer)
end
delete(timerfind('tag','MyTimer'));
delete(hObject);
Best Answer