warning('perfect_foresight_with_expectation_errors_setup: since you passed the datafile option, the contents of shocks and endval blocks will be ignored')
end
%% Read CSV file
%% We can’t use readcell (only in MATLAB ≥ R2019a), so instead rely on csvread and manual hacks
% Read numeric data, skipping first row and first column
raw_csv=csvread(options_.datafile,1,1);
ifsize(raw_csv,1)-2~=periods
error(['perfect_foresight_with_expectation_errors_setup: the number of rows in 'options_.datafile' does not match the periods setting'])
end
% Read first line (exogenous variable names)
fid=fopen(options_.datafile);
csv_first_line=fgetl(fid);
fclose(fid);
exo_header_names=strsplit(csv_first_line,',');
exo_header_names=exo_header_names(2:end);% Remove first column
ifnumel(exo_header_names)~=size(raw_csv,2)
error(['perfect_foresight_with_expectation_errors_setup: first line malformed in 'options_.datafile])
end
%% Create and fill structures containing information sets
warning('perfect_foresight_with_expectation_errors_setup: there is no shocks(learnt_in=...) or endval(learnt_in=...) block, and you did not pass the datafile option, so there is no point in using this command')
end
%% Initialize information set at period 1 using “bare” shocks and endval blocks (or initval if there is no endval)