Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function varargout = GUI(varargin)
- % Begin initialization code - DO NOT EDIT
- gui_Singleton = 1;
- gui_State = struct('gui_Name', mfilename, ...
- 'gui_Singleton', gui_Singleton, ...
- 'gui_OpeningFcn', @GUI_OpeningFcn, ...
- 'gui_OutputFcn', @GUI_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 GUI is made visible.
- function GUI_OpeningFcn(hObject, eventdata, handles, varargin)
- % Choose default command line output for GUI
- handles.output = hObject;
- % Update handles structure
- guidata(hObject, handles);
- % UIWAIT makes GUI wait for user response (see UIRESUME)
- % uiwait(handles.figure1);
- % --- Outputs from this function are returned to the command line.
- function varargout = GUI_OutputFcn(hObject, eventdata, handles)
- % Get default command line output from handles structure
- varargout{1} = handles.output;
- % --- Executes on slider movement.
- function slider_Callback(hObject, eventdata, handles)
- % hObject handle to slider (see GCBO)
- % eventdata reserved - to be defined in a future version of MATLAB
- % handles structure with handles and user data (see GUIDATA)
- slideVal = get(handles.slider,'Value');
- assignin('base','slideVal',slideVal);
- set(handles.amp,'String',num2str(slideVal));
- % 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 slider_CreateFcn(hObject, eventdata, handles)
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
- function period_Callback(hObject, eventdata, handles)
- % --- Executes during object creation, after setting all properties.
- function period_CreateFcn(hObject, eventdata, handles)
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- function amp_Callback(hObject, eventdata, handles)
- function amp_CreateFcn(hObject, eventdata, handles)
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes on button press in plot.
- function plot_Callback(hObject, eventdata, handles)
- amplitude = str2num(get(handles.amp,'String'));
- period = str2num(get(handles.period,'String'));
- a = get(handles.func,'value');
- n = [0:0.01:10*pi];
- if (a == 1)
- fig = plot(amplitude*sin(period*n));
- elseif (a==2)
- fig=plot(amplitude*cos(period*n));
- else
- fig=plot(amplitude*tan(period*n));
- end
- axes(handles.axes1);
- h = impoly();
- nodes = getPosition(h);
- %position = wait(h)
- nodes
- % now you go and position the polygon, control returns once you've 'finsished' with it '
- guidata(hObject,handles)
- % --- Executes during object creation, after setting all properties.
- function axes1_CreateFcn(hObject, eventdata, handles)
- % --- Executes on selection change in func.
- function func_Callback(hObject, eventdata, handles)
- % --- Executes during object creation, after setting all properties.
- function func_CreateFcn(hObject, eventdata, handles)
- if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor','white');
- end
- % --- Executes on slider movement.
- function slider2_Callback(hObject, eventdata, handles)
- slideVal2 = get(handles.slider2,'Value');
- assignin('base','slideVal2',slideVal2);
- set(handles.period,'String',num2str(slideVal2));
- function slider2_CreateFcn(hObject, eventdata, handles)
- % Hint: slider controls usually have a light gray background.
- if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
- set(hObject,'BackgroundColor',[.9 .9 .9]);
- end
Advertisement
Add Comment
Please, Sign In to add comment