'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Interface_OpeningFcn, ...
'gui_OutputFcn', @Interface_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 Interface is made visible.
function Interface_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 Interface (see VARARGIN)
handles.contador = 0;
display(handles.contador)
assignin('base','handles',handles)
% Choose default command line output for Interface
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Interface wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Interface_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 btnDesenhar.
function btnDesenhar_Callback(hObject, eventdata, handles)
% hObject handle to btnDesenhar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%Incrementa o contador
handles.contador = handles.contador + 1;
display(handles.contador)
%handles
%Axis 1
hold(handles.axes1,'off')
amostras = [0:1:1000];
if not(isempty(str2num(get(handles.edtFrequencias,'String'))))
Freq = str2num(get(handles.edtFrequencias,'String'))
onda = 2*pi*Freq*0.001*amostras;
plot(handles.axes1,sin(onda))
grid(handles.axes1,'on')
assignin('base','contador',handles.contador);
assignin('base','hObject',hObject)
% Update handles structure
guidata(hObject, handles);
if (get(handles.rbtCosseno,'Value') == 1)
%Axis 2
plot(handles.axes2,cos(onda))
grid(handles.axes2,'on')
elseif (get(handles.rbtTangente,'Value') == 1)
%Axis 2
plot(handles.axes2,tan(onda))
grid(handles.axes2,'on')
ylim(handles.axes2,[-2,2])
else
errordlg('Selecione uma onda de saída!')
end
end
% --- Executes on button press in rbtCosseno.
function rbtCosseno_Callback(hObject, eventdata, handles)
% hObject handle to rbtCosseno (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 rbtCosseno
set(hObject,'Value',1)
set(handles.rbtTangente,'Value',0)
% --- Executes on button press in rbtTangente.
function rbtTangente_Callback(hObject, eventdata, handles)
% hObject handle to rbtTangente (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 rbtTangente
set(hObject,'Value',1)
set(handles.rbtCosseno,'Value',0)
function edtFrequencias_Callback(hObject, eventdata, handles)
% hObject handle to edtFrequencias (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 edtFrequencias as text
% str2double(get(hObject,'String')) returns contents of edtFrequencias as a double
% --- Executes during object creation, after setting all properties.
function edtFrequencias_CreateFcn(hObject, eventdata, handles)
% hObject handle to edtFrequencias (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 usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
</syntaxhighlight>