Code covered by the BSD License  

Highlights from
MATLAB no Desenvolvimento de Modelos para Financas

image thumbnail
from MATLAB no Desenvolvimento de Modelos para Financas by Elia Matsumoto
Slides and demo files using Brazilian market data.

GP(varargin)
function varargout = GP(varargin)
% GP M-file for GP.fig
%      GP, by itself, creates a new GP or raises the existing
%      singleton*.
%
%      H = GP returns the handle to a new GP or the handle to
%      the existing singleton*.
%
%      GP('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in GP.M with the given input arguments.
%
%      GP('Property','Value',...) creates a new GP or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before GP_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to GP_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

% Edit the above text to modify the response to help GP

% Last Modified by GUIDE v2.5 12-Sep-2008 16:40:23

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @GP_OpeningFcn, ...
                   'gui_OutputFcn',  @GP_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 GP is made visible.
function GP_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 GP (see VARARGIN)

% Choose default command line output for GP
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes GP wait for user response (see UIRESUME)
% uiwait(handles.GP);


% --- Outputs from this function are returned to the command line.
function varargout = GP_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 wTNLP4_Callback(hObject, eventdata, handles)
% hObject    handle to wTNLP4 (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 wTNLP4 as text
%        str2double(get(hObject,'String')) returns contents of wTNLP4 as a double


% --- Executes during object creation, after setting all properties.
function wTNLP4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wTNLP4 (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



function wPETR4_Callback(hObject, eventdata, handles)
% hObject    handle to wPETR4 (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 wPETR4 as text
%        str2double(get(hObject,'String')) returns contents of wPETR4 as a double


% --- Executes during object creation, after setting all properties.
function wPETR4_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wPETR4 (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



function wUSIM5_Callback(hObject, eventdata, handles)
% hObject    handle to wUSIM5 (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 wUSIM5 as text
%        str2double(get(hObject,'String')) returns contents of wUSIM5 as a double


% --- Executes during object creation, after setting all properties.
function wUSIM5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wUSIM5 (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



function wVALE5_Callback(hObject, eventdata, handles)
% hObject    handle to wVALE5 (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 wVALE5 as text
%        str2double(get(hObject,'String')) returns contents of wVALE5 as a double


% --- Executes during object creation, after setting all properties.
function wVALE5_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wVALE5 (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



function wCSNA3_Callback(hObject, eventdata, handles)
% hObject    handle to wCSNA3 (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 wCSNA3 as text
%        str2double(get(hObject,'String')) returns contents of wCSNA3 as a double


% --- Executes during object creation, after setting all properties.
function wCSNA3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wCSNA3 (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



function wEMBR3_Callback(hObject, eventdata, handles)
% hObject    handle to wEMBR3 (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 wEMBR3 as text
%        str2double(get(hObject,'String')) returns contents of wEMBR3 as a double


% --- Executes during object creation, after setting all properties.
function wEMBR3_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wEMBR3 (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



function wRiskfree_Callback(hObject, eventdata, handles)
% hObject    handle to wRiskfree (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 wRiskfree as text
%        str2double(get(hObject,'String')) returns contents of wRiskfree as a double


% --- Executes during object creation, after setting all properties.
function wRiskfree_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wRiskfree (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



function wRisco_Callback(hObject, eventdata, handles)
% hObject    handle to wRisco (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 wRisco as text
%        str2double(get(hObject,'String')) returns contents of wRisco as a double


% --- Executes during object creation, after setting all properties.
function wRisco_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wRisco (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



function riRisco_Callback(hObject, eventdata, handles)
% hObject    handle to riRisco (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 riRisco as text
%        str2double(get(hObject,'String')) returns contents of riRisco as a double


% --- Executes during object creation, after setting all properties.
function riRisco_CreateFcn(hObject, eventdata, handles)
% hObject    handle to riRisco (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



function riRetorno_Callback(hObject, eventdata, handles)
% hObject    handle to riRetorno (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 riRetorno as text
%        str2double(get(hObject,'String')) returns contents of riRetorno as a double


% --- Executes during object creation, after setting all properties.
function riRetorno_CreateFcn(hObject, eventdata, handles)
% hObject    handle to riRetorno (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



function rtRisco_Callback(hObject, eventdata, handles)
% hObject    handle to rtRisco (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 rtRisco as text
%        str2double(get(hObject,'String')) returns contents of rtRisco as a double


% --- Executes during object creation, after setting all properties.
function rtRisco_CreateFcn(hObject, eventdata, handles)
% hObject    handle to rtRisco (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



function rtRetorno_Callback(hObject, eventdata, handles)
% hObject    handle to rtRetorno (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 rtRetorno as text
%        str2double(get(hObject,'String')) returns contents of rtRetorno as a double


% --- Executes during object creation, after setting all properties.
function rtRetorno_CreateFcn(hObject, eventdata, handles)
% hObject    handle to rtRetorno (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


% --- Executes on slider movement.
function GAR_Callback(hObject, eventdata, handles)
% hObject    handle to GAR (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 GAR_CreateFcn(hObject, eventdata, handles)
% hObject    handle to GAR (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.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor',[.9 .9 .9]);
end


% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
display('teste');
[x,y,button]=ginput(1);
if button == 1
    set(obj,'UserData',[x y]);
end




function wIBOVESPA_Callback(hObject, eventdata, handles)
% hObject    handle to wIBOVESPA (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 wIBOVESPA as text
%        str2double(get(hObject,'String')) returns contents of wIBOVESPA as a double


% --- Executes during object creation, after setting all properties.
function wIBOVESPA_CreateFcn(hObject, eventdata, handles)
% hObject    handle to wIBOVESPA (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


Contact us at files@mathworks.com