Code covered by the BSD License  

Highlights from
Forecasting the FTSE 100 with high-frequency data: A comparison of realized measures

Forecasting the FTSE 100 with high-frequency data: A comparison of realized measures

by

 

16 Sep 2011 (Updated )

My dissertation for the MSc in Finance & Economics from Warwick Business School

bp(h,numout,varargin)
function out = bp(h,numout,varargin)

% BP loops function over dataset
%
%   BP(H,NUMOUT) Executes function H on the dataset. To retrieve sequential
%                outputs for the function H, specify the number of outputs
%                NUMOUT.
%                Example: h = @min; bp(h,2) will execute [C,I] = min(...)
%
%   BP(...,VARARGIN) Additional inputs for anonymous functions
%                    Example: h = @(data,x) min(data)-x; bp(h,1,[{1};{2}])
%
%   OUT = BP(...)
%       OUT is a cell array containing the result of H: data -> out
%
% See also: HANDLE

% Author: Oleg Komarov (oleg.komarov@hotmail.it)
% Tested on R2011a.
% 17 jul 2011 - Created

% NINPUTS
error(nargchk(1,nargin,nargin));

% NUMOUT
if nargin == 1 || isempty(numout)
    numout = 1;
end

d = 'C:\Users\Oleg\Desktop\Dissertation\Data\dataset.mat';
load(d,'fields');

nF  = numel(fields); %#ok <LOAD>
out = cell(nF,numout); 
varargin = [varargin{:}];
for b = 1:nF
    tmp = load(d,fields{b});
    if nargin > 2
        [out{b,1:numout}] = h(tmp.(fields{b}),varargin{b,:});
    else
        [out{b,1:numout}] = h(tmp.(fields{b}));
    end
end

Contact us