diff --git a/doc/dynare.texi b/doc/dynare.texi
index f925be155444a636c9c79d3a91621d1e996ab5fb..e1fd29cb1137d6ff38b37e12ea9a0d59f73e0469 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -4586,7 +4586,8 @@ where @var{THEORETICAL_MOMENT} is one of the following:
 Variance-covariance of endogenous variables
 
 @item correlation
-Autocorrelation of endogenous variables
+Auto- and cross-correlation of endogenous variables. Fields are vectors with correlations from 1 up to order @code{options_.ar}
+
 
 @item VarianceDecomposition
 Decomposition of variance@footnote{When the shocks are correlated, it
diff --git a/matlab/correlation_mc_analysis.m b/matlab/correlation_mc_analysis.m
index 9cd7cafb58697eee261bb81a8ea823fd0656d6c9..3625955da09d036bb036f41ea83b9f4eeaf52e53 100644
--- a/matlab/correlation_mc_analysis.m
+++ b/matlab/correlation_mc_analysis.m
@@ -49,9 +49,9 @@ if isfield(oo_,[TYPE 'TheoreticalMoments'])
         eval(['temporary_structure = oo_.' TYPE 'TheoreticalMoments.dsge;'])
         if isfield(temporary_structure,'correlation')
             eval(['temporary_structure = oo_.' TYPE 'TheoreticalMoments.dsge.correlation.Mean;'])
-            if isfield(temporary_structure,var1)
+            if isfield(temporary_structure,deblank(var1))
                 eval(['temporary_structure_1 = oo_.' TYPE 'TheoreticalMoments.dsge.correlation.Mean.' var1 ';']) 
-                if isfield(temporary_structure_1,var2)
+                if isfield(temporary_structure_1,deblank(var2))
                     eval(['temporary_structure_2 = temporary_structure_1.' var2 ';'])
                     l1 = length(temporary_structure_2);
                     if l1<nar