diff --git a/doc/dynare.texi b/doc/dynare.texi
index f7e23a9c180fe1a503a962588dbc4bdce95eeacf..0fbc242b278e43fd66faf4653a975b6f19e5eb01 100644
--- a/doc/dynare.texi
+++ b/doc/dynare.texi
@@ -10069,11 +10069,15 @@ following @LaTeX{} packages: @code{longtable, booktabs}
 
 @deffn {MATLAB/Octave command} write_latex_prior_table ;
 
-Writes descriptive statistics about the prior distribution to
-a @LaTeX{} table in a file named @code{<<M_.fname>>_latex_priors_table.tex}. The command writes the prior
-definitions currently stored. Thus, the command must be invoked after the @code{estimated_params} block. The command
-returns an error if no prior densities are defined (ML estimation). Requires the following @LaTeX{}
-packages: @code{longtable, booktabs}
+Writes descriptive statistics about the prior distribution to a @LaTeX{} table
+in a file named @code{<<M_.fname>>_latex_priors_table.tex}. The command writes
+the prior definitions currently stored. Thus, this command must be invoked
+after the @code{estimated_params} block. If priors are defined over the
+measurement errors, the command must also be preceeded by the declaration of
+the observed variables (with @code{varobs}). The command displays a warning if
+no prior densities are defined (ML estimation) or if the declaration of the
+observed variables is missing. Requires the following @LaTeX{} packages:
+@code{longtable, booktabs}
 @end deffn
 
 @deffn {MATLAB/Octave command} collect_LaTeX_Files (@code{M_}) ;
diff --git a/matlab/isbayes.m b/matlab/isbayes.m
new file mode 100644
index 0000000000000000000000000000000000000000..5921f67bc98f72fe84b82032f58aceb6ab03a916
--- /dev/null
+++ b/matlab/isbayes.m
@@ -0,0 +1,44 @@
+function l = isbayes(estim_params_)
+
+% Returns true iff bayesian priors over parameters are defined.
+
+% Copyright (C) 2016 Dynare Team
+%
+% This file is part of Dynare.
+%
+% Dynare is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% Dynare is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
+
+l = false;
+
+if ~isstruct(estim_params_)
+    return
+end
+
+if isempty(estim_params_)
+    return
+end
+
+ptypes = {'param_vals', 5; 'var_exo', 5 ; 'var_endo', 5; 'corrx', 6; 'corrn', 6};
+
+for i=1:size(ptypes, 1)
+    if isfield(estim_params_, ptypes{i, 1})
+        tmp = estim_params_.(ptypes{i, 1});
+        if ~isempty(tmp)
+            if any(tmp(:,ptypes{i, 2})>0)
+                l = true;
+                return
+            end
+        end
+    end
+end
\ No newline at end of file
diff --git a/matlab/write_latex_prior_table.m b/matlab/write_latex_prior_table.m
index 3b39c46a143ee6c14ef6ec792f53973630869284..8d841605db0de04a467bec0e731ccc2a5ae2ef99 100644
--- a/matlab/write_latex_prior_table.m
+++ b/matlab/write_latex_prior_table.m
@@ -30,12 +30,24 @@ function write_latex_prior_table
 
 global M_ options_ bayestopt_ estim_params_
 
-if ~any(bayestopt_.pshape > 0)
+if ~isbayes(estim_params_)
     fprintf('\nwrite_latex_prior_table:: No prior distributions detected. Skipping table creation.\n')
     return
 end
-    
-% get untruncated bounds
+
+if (size(estim_params_.var_endo,1) || size(estim_params_.corrn,1))
+    % Prior over measurement errors are defined...
+   if ((isfield(options_,'varobs') && isempty(options_.varobs)) || ~isfield(options_,'varobs'))
+       % ... But the list of observed variabled is not yet defined.
+       fprintf(['\nwrite_latex_prior_table:: varobs should be declared before. Skipping table creation.\n'])
+       return
+   end
+end
+
+% Fill or update bayestopt_ structure
+[xparam1, estim_params_, bayestopt_, lb, ub, M_] = set_prior(estim_params_, M_, options_);
+
+% Get untruncated bounds
 bounds = prior_bounds(bayestopt_, options_.prior_trunc);
 lb=bounds.lb;
 ub=bounds.ub;