From 176baa2215a7a512e79d8f4c97faa20daa890f44 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Wed, 30 Mar 2022 08:51:52 +0200
Subject: [PATCH] MoM: fix reading of XLS-files by assigning sheet info to base
 workspace

Closes https://git.dynare.org/Dynare/dynare/-/issues/1840
---
 matlab/+mom/run.m | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/matlab/+mom/run.m b/matlab/+mom/run.m
index 1dbc716320..05a56a12c5 100644
--- a/matlab/+mom/run.m
+++ b/matlab/+mom/run.m
@@ -206,6 +206,14 @@ options_mom_ = set_default_option(options_mom_,'nobs',NaN);        % number of o
 options_mom_ = set_default_option(options_mom_,'prefilter',false); % demean each data series by its empirical mean and use centered moments
 options_mom_ = set_default_option(options_mom_,'xls_sheet',1);     % name of sheet with data in Excel
 options_mom_ = set_default_option(options_mom_,'xls_range','');    % range of data in Excel sheet
+% temporary workaround for https://git.dynare.org/Dynare/dseries/-/issues/51
+if options_mom_.xls_sheet~=1
+    evalin('base','options_.xls_sheet=options_mom_.xls_sheet');
+end
+if ~isempty(options_mom_.xls_range)
+    evalin('base','options_.xls_range=options_mom_.xls_range');
+end
+
 % Recursive estimation and forecast are not supported
 if numel(options_mom_.nobs)>1
     error('method_of_moments: Recursive estimation and forecast for samples is not supported. Please set an integer as ''nobs''.');
-- 
GitLab