From 820df39ff70db8e032682e24d019b7a2212c799d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 16 Jun 2021 17:13:56 +0200
Subject: [PATCH] Compatibility fix for MATLAB < R2019b
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

MATLAB < R2019b does not accept “bar(1, [2 3])”.
---
 matlab/plot_identification.m | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/matlab/plot_identification.m b/matlab/plot_identification.m
index 5fa7227178..f95d30025f 100644
--- a/matlab/plot_identification.m
+++ b/matlab/plot_identification.m
@@ -19,7 +19,7 @@ function plot_identification(params, idemoments, idehess, idemodel, idelre, adva
 % SPECIAL REQUIREMENTS
 %    None
 
-% Copyright (C) 2008-2017 Dynare Team
+% Copyright (C) 2008-2021 Dynare Team
 %
 % This file is part of Dynare.
 %
@@ -59,7 +59,8 @@ if SampleSize == 1
     subplot(211)
     mmm = (idehess.ide_strength_dMOMENTS);
     [ss, is] = sort(mmm);
-    if ~all(isnan(idehess.ide_strength_dMOMENTS_prior))
+    if ~all(isnan(idehess.ide_strength_dMOMENTS_prior)) ...
+       && ~(nparam == 1 && ~isoctave && matlab_ver_less_than('9.7')) % MATLAB < R2019b does not accept bar(1, [2 3])
         bar(1:nparam,log([idehess.ide_strength_dMOMENTS(:,is)' idehess.ide_strength_dMOMENTS_prior(:,is)']))
     else
         bar(1:nparam,log([idehess.ide_strength_dMOMENTS(:,is)' ]))
@@ -105,7 +106,8 @@ if SampleSize == 1
     end
 
     subplot(212)
-    if ~all(isnan(idehess.deltaM_prior))
+    if ~all(isnan(idehess.deltaM_prior)) ...
+       && ~(nparam == 1 && ~isoctave && matlab_ver_less_than('9.7')) % MATLAB < R2019b does not accept bar(1, [2 3])
         bar(1:nparam, log([idehess.deltaM(is) idehess.deltaM_prior(is)]))
     else
         bar(1:nparam, log([idehess.deltaM(is)]))
-- 
GitLab