From 2ee03c7e286b87f84c512618e0f90aaa8c2362ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 4 Feb 2021 16:54:09 +0100
Subject: [PATCH] OLS: Octave compatibility fix

Cell arrays cannot be used for derefencing fields in a structure.

For some unknown reason, this was nevertheless accepted by MATLAB in this
context.
---
 matlab/ols/dyn_ols.m | 6 +++---
 matlab/olsgibbs.m    | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/matlab/ols/dyn_ols.m b/matlab/ols/dyn_ols.m
index dcb29aa02d..2a726a03db 100644
--- a/matlab/ols/dyn_ols.m
+++ b/matlab/ols/dyn_ols.m
@@ -28,7 +28,7 @@ function ds = dyn_ols(ds, fitted_names_dict, eqtags, model_name, param_names, ds
 % SPECIAL REQUIREMENTS
 %   dynare must have been run with the option: json=compute
 
-% Copyright (C) 2017-2020 Dynare Team
+% Copyright (C) 2017-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -186,7 +186,7 @@ for i = 1:length(Y)
         oo_.ols.(tag).Yhat = ...
             feval(fitted_names_dict{idx, 3}, oo_.ols.(tag).Yhat);
     end
-    ds.(oo_.ols.(tag).Yhat.name) = oo_.ols.(tag).Yhat;
+    ds.(oo_.ols.(tag).Yhat.name{:}) = oo_.ols.(tag).Yhat;
 
     %% Calculate statistics
     % Estimate for sigma^2
@@ -233,4 +233,4 @@ for i = 1:length(Y)
             [oo_.ols.(tag).beta oo_.ols.(tag).tstat oo_.ols.(tag).stderr]);
     end
 end
-end
\ No newline at end of file
+end
diff --git a/matlab/olsgibbs.m b/matlab/olsgibbs.m
index 43dfef938b..3365515825 100644
--- a/matlab/olsgibbs.m
+++ b/matlab/olsgibbs.m
@@ -30,7 +30,7 @@ function ds = olsgibbs(ds, eqtag, BetaPriorExpectation, BetaPriorVariance, s2, n
 % SPECIAL REQUIREMENTS
 %   dynare must have been run with the option: json=compute
 
-% Copyright (C) 2018-2019 Dynare Team
+% Copyright (C) 2018-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -245,7 +245,7 @@ if any(idx) ...
     oo_.olsgibbs.(model_name).Yhat = ...
         feval(fitted_names_dict{idx, 3}, oo_.olsgibbs.(model_name).Yhat);
 end
-ds.(oo_.olsgibbs.(model_name).Yhat.name) = oo_.olsgibbs.(model_name).Yhat;
+ds.(oo_.olsgibbs.(model_name).Yhat.name{:}) = oo_.olsgibbs.(model_name).Yhat;
 
 % Compute and save posterior densities.
 for i=1:n
-- 
GitLab