function varargout = spinnergui(varargin)
%SPINNERGUI M-file for spinnergui.fig
% SPINNERGUI, by itself, creates a new SPINNERGUI or raises the existing
% singleton*.
%
% H = SPINNERGUI returns the handle to a new SPINNERGUI or the handle to
% the existing singleton*.
%
% SPINNERGUI('Property','Value',...) creates a new SPINNERGUI using the
% given property value pairs. Unrecognized properties are passed via
% varargin to spinnergui_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% SPINNERGUI('CALLBACK') and SPINNERGUI('CALLBACK',hObject,...) call the
% local function named CALLBACK in SPINNERGUI.M with the given input
% arguments.
%
% *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 spinnergui
% Last Modified by GUIDE v2.5 15-Sep-2004 17:16:19
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @spinnergui_OpeningFcn, ...
'gui_OutputFcn', @spinnergui_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 spinnergui is made visible.
function spinnergui_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 unrecognized PropertyName/PropertyValue pairs from the
% command line (see VARARGIN)
% Choose default command line output for spinnergui
handles.output = hObject;
handles.spinner1 = spinner('Parent',handles.figure1,...
'Position',[20 20 100 60],...
'Callback',{@spinner_Callback1,handles.figure1},...
'Tag','spinner1');
handles.spinner2 = spinner('Parent',handles.figure1,...
'Position',[140 20 100 60],...
'Callback',{@spinner_Callback1,handles.figure1},...
'Tag','spinner2');
% handles.spinner1 = spinner('Parent',handles.figure1,...
% 'Position',[20 20 100 60],...
% 'Callback',@spinner_Callback2);
% handles.spinner2 = spinner('Parent',handles.figure1,...
% 'Position',[140 20 100 60],...
% 'Callback',@spinner_Callback2);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes spinnergui wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = spinnergui_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;
% ---------------------------------------------------------
function spinner_Callback1(hFig)
% get handles structure
handles = guidata(hFig);
% get spinner data for the spinners
sdata1 = spinner(handles.spinner1);
sdata2 = spinner(handles.spinner2);
% plot
plot(1:10,get(sdata1.edit,'Value') * [1:10],1:10,get(sdata2.edit,'Value') * [1:10]);
% ---------------------------------------------------------
function spinner_Callback2(hObject,eventdata)
hFig = ancestor(hObject,'figure');
% get handles structure
handles = guidata(hFig);
% get spinner data for the spinners
sdata1 = spinner(handles.spinner1);
sdata2 = spinner(handles.spinner2);
% plot
plot(1:10,get(sdata1.edit,'Value') * [1:10],1:10,get(sdata2.edit,'Value') * [1:10]);
% ---------------------------------------------------------
function s = spinnerdata(h,val)
if ~strcmp(get(h,'Type'),'figure')
h = ancestor(h,'figure');
end
if nargin == 1 && nargout == 1
s = getappdata(h,get_spinnerdata_name);
elseif nargin == 2
setappdata(h,get_spinnerdata_name,val);
end
% ---------------------------------------------------------
function str = get_spinnerdata_name
str = 'SpinnerAppData';
% --- 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)