Various MATLAB R2014a compatibility fixes
parent
8d4f5fbd9b
commit
e42cf2e5b4
|
@ -98,7 +98,11 @@ if T_max > 0
|
|||
for i = T_max-1:-1:1
|
||||
tmp = 0*binding_indicator;
|
||||
tmp(1:end-i+1,:) = binding_indicator(i:end,:);
|
||||
if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b
|
||||
itmp = find(~any(bsxfun(@minus, dictionary.binding_indicator(1:length(tmp)*2,:), tmp(:))));
|
||||
else
|
||||
itmp = find(~any(dictionary.binding_indicator(1:length(tmp)*2,:)-tmp(:)));
|
||||
end
|
||||
if ~isempty(itmp)
|
||||
ireg(i) = itmp;
|
||||
else
|
||||
|
|
|
@ -89,7 +89,11 @@ if T_max > 0
|
|||
|
||||
tmp = 0*binding_indicator;
|
||||
tmp(1:end-i+1) = binding_indicator(i:end);
|
||||
if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b
|
||||
itmp = find(~any(bsxfun(@minus, dictionary.binding_indicator, tmp)));
|
||||
else
|
||||
itmp = find(~any(dictionary.binding_indicator-tmp));
|
||||
end
|
||||
if ~isempty(itmp)
|
||||
ireg(i) = itmp;
|
||||
else
|
||||
|
|
|
@ -74,9 +74,17 @@ end
|
|||
|
||||
% add back steady state
|
||||
if ~options_.occbin.simul.piecewise_only
|
||||
if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b
|
||||
out.linear = bsxfun(@plus, out.linear, out.ys');
|
||||
else
|
||||
out.linear = out.linear + out.ys';
|
||||
end
|
||||
end
|
||||
if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b
|
||||
out.piecewise = bsxfun(@plus, out.piecewise, out.ys');
|
||||
else
|
||||
out.piecewise = out.piecewise + out.ys';
|
||||
end
|
||||
out.exo_pos = options_.occbin.simul.exo_pos;
|
||||
|
||||
oo_.occbin=out;
|
||||
|
|
|
@ -51,14 +51,18 @@ else
|
|||
xlsmat{tp,5}=int2str(regime_history(tp).regimestart2);
|
||||
end
|
||||
end
|
||||
filename=[OutputDirectoryName filesep xls_filename '.xls'];
|
||||
if matlab_ver_less_than('9.3')
|
||||
if exist(filename,'file')
|
||||
delete(filename)
|
||||
end
|
||||
if ~ispc && ~isoctave && matlab_ver_less_than('9.0')
|
||||
% On GNU/Linux and macOS, with MATLAB < R2016a, “writeable” can’t write Excel files
|
||||
warning('This version of MATLAB is too old and cannot create Excel files. The Occbin regimes will rather be written to a CSV file')
|
||||
filename=[OutputDirectoryName filesep xls_filename '.csv'];
|
||||
else
|
||||
filename=[OutputDirectoryName filesep xls_filename '.xls'];
|
||||
end
|
||||
if isfile(filename)
|
||||
delete(filename)
|
||||
end
|
||||
end
|
||||
if ~ispc && ~isoctave && matlab_ver_less_than('9.0') % See above
|
||||
writetable(array2table(xlsmat,'VariableNames',Header), filename);
|
||||
else
|
||||
writetable(array2table(xlsmat,'VariableNames',Header), filename, 'Sheet', 'Regimes');
|
||||
end
|
||||
|
|
|
@ -206,8 +206,8 @@ else
|
|||
0.480506381923643
|
||||
-0.111002148299648
|
||||
1.000000000000000];
|
||||
if max(abs(BETA' - good)) > 1e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA - good)))]);
|
||||
if max(abs(BETA' - good)) > 2e-14
|
||||
error(['sum of BETA'' - good was: ' num2str(sum(abs(BETA' - good)))]);
|
||||
end
|
||||
return
|
||||
end
|
||||
|
|
|
@ -21,14 +21,14 @@ M.orig_maximum_lag = 2;
|
|||
caller = 'INITVAL';
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
ds1 = histvalf_initvalf(caller, M, options);
|
||||
|
||||
failed_tests = my_assert(failed_tests, all(all(ds1 == ds)), 'basic test');
|
||||
num_tests = num_tests + 1;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds1";
|
||||
options.series = 'ds1';
|
||||
options.first_obs = 2;
|
||||
ds1 = histvalf_initvalf(caller, M, options);
|
||||
failed_tests = my_assert(failed_tests, ds1.init == dates('2Y'), ...
|
||||
|
@ -36,7 +36,7 @@ failed_tests = my_assert(failed_tests, ds1.init == dates('2Y'), ...
|
|||
num_tests = num_tests + 1;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
options.first_obs = 2;
|
||||
options.last_obs = 9;
|
||||
ds1 = histvalf_initvalf(caller, M, options);
|
||||
|
@ -47,7 +47,7 @@ failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
|||
num_tests = num_tests + 2;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
options.last_obs = 9;
|
||||
ds1 = histvalf_initvalf(caller, M, options);
|
||||
failed_tests = my_assert(failed_tests, ds1.init == dates('1Y'), ...
|
||||
|
@ -57,7 +57,7 @@ failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
|||
num_tests = num_tests + 2;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
options.first_obs = 2;
|
||||
options.last_obs = 9;
|
||||
options.nobs = 8;
|
||||
|
@ -69,7 +69,7 @@ failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
|||
num_tests = num_tests + 2;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
options.last_obs = 9;
|
||||
options.nobs = 8;
|
||||
ds1 = histvalf_initvalf(caller, M, options);
|
||||
|
@ -80,7 +80,7 @@ failed_tests = my_assert(failed_tests, ds1.last == dates('9Y'), ...
|
|||
num_tests = num_tests + 2;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
options.first_obs = 2;
|
||||
options.last_obs = 9;
|
||||
options.nobs = 7;
|
||||
|
@ -98,7 +98,7 @@ end
|
|||
num_tests = num_tests + 1;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
options.first_obs = 0;
|
||||
|
||||
try
|
||||
|
@ -113,7 +113,7 @@ end
|
|||
num_tests = num_tests + 1;
|
||||
|
||||
options = struct();
|
||||
options.series = "ds";
|
||||
options.series = 'ds';
|
||||
options.last_obs = 11;
|
||||
|
||||
try
|
||||
|
|
|
@ -17,7 +17,11 @@ ylabels = char(percent,percent,percent,level);
|
|||
figtitle = 'Simulated variables';
|
||||
legendlist = cellstr(char('Piecewise Linear','Linear'));
|
||||
|
||||
if isoctave || ~matlab_ver_less_than('8.4')
|
||||
% For some unknown reason, MATLAB R2014a crashes with TeX labels
|
||||
% when -nodisplay is passed (as in the testsuite)
|
||||
options_.TeX=1;
|
||||
end
|
||||
occbin_graph;
|
||||
occbin_graph c_hat b_hat y_hat;
|
||||
|
||||
|
|
Loading…
Reference in New Issue