1function w=row_header_width(M_,estim_params_,bayestopt_)
2% This function computes the width of the row headers for
3% the estimation results
4%
5% INPUTS
6%   estim_params_    [structure]
7%   M_               [structure]
8%   bayestopt_       [structure]
9%
10% OUTPUTS
11%   w                integer
12%
13% SPECIAL REQUIREMENTS
14%   None.
15
16% Copyright (C) 2006-2018 Dynare Team
17%
18% This file is part of Dynare.
19%
20% Dynare is free software: you can redistribute it and/or modify
21% it under the terms of the GNU General Public License as published by
22% the Free Software Foundation, either version 3 of the License, or
23% (at your option) any later version.
24%
25% Dynare is distributed in the hope that it will be useful,
26% but WITHOUT ANY WARRANTY; without even the implied warranty of
27% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28% GNU General Public License for more details.
29%
30% You should have received a copy of the GNU General Public License
31% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
32
33np = estim_params_.np;
34nvx = estim_params_.nvx;
35nvn = estim_params_.nvn;
36ncx = estim_params_.ncx;
37ncn = estim_params_.ncn;
38
39w = 0;
40if np
41    w = cellofchararraymaxlength(bayestopt_.name);
42end
43if nvx
44    w = max(w, cellofchararraymaxlength(M_.endo_names(estim_params_.var_exo(1:nvx,1))));
45end
46if nvn
47    w = max(w, cellofchararraymaxlength(M_.endo_names(estim_params_.var_endo(1:nvn,1))));
48end
49if ncx
50    for i=1:ncx
51        k1 = estim_params_.corrx(i,1);
52        k2 = estim_params_.corrx(i,2);
53        w = max(w, length(M_.exo_names{k1})+length(M_.exo_names{k2}));
54
55    end
56end
57if ncn
58    for i=1:ncn
59        k1 = estim_params_.corrn(i,1);
60        k2 = estim_params_.corrn(i,2);
61        w = max(w, length(M_.endo_names{k1})+length(M_.endo_names{k2}));
62    end
63end
64