1function [ivar, vartan, options_] = get_variables_list(options_, M_)
2
3% This function builds a vector of indices in varlist or varobs.
4%
5% INPUTS
6%   o options_   [structure]             Describes global options.
7%   o M_         [structure]             Describes the model.
8%
9% OUTPUTS
10%   o ivar       [integer]               nvar*1 vector of indices (nvar is the number
11%                                        of variables).
12%   o vartan     [cell of char arrays]   array of characters (with nvar rows).
13%   o options_   [structure]             Describes global options.
14%
15% ALGORITHM
16%   None.
17%
18% SPECIAL REQUIREMENTS
19%   None.
20
21% Copyright (C) 2007-2018 Dynare Team
22%
23% This file is part of Dynare.
24%
25% Dynare is free software: you can redistribute it and/or modify
26% it under the terms of the GNU General Public License as published by
27% the Free Software Foundation, either version 3 of the License, or
28% (at your option) any later version.
29%
30% Dynare is distributed in the hope that it will be useful,
31% but WITHOUT ANY WARRANTY; without even the implied warranty of
32% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33% GNU General Public License for more details.
34%
35% You should have received a copy of the GNU General Public License
36% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
37
38varlist = options_.varlist;
39if isempty(varlist)
40    varlist = options_.varobs;
41    options_.varlist = varlist;
42end
43nvar = length(varlist);
44vartan = varlist;
45ivar = zeros(nvar,1);
46for i = 1:nvar
47    ivar(i) = strmatch(vartan{i}, M_.endo_names, 'exact');
48end