


Copyright (C) 2010-2011 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/>.


0001 function [indices] = select_from_table(table,key,value) 0002 % Copyright (C) 2010-2011 Dynare Team 0003 % 0004 % This file is part of Dynare. 0005 % 0006 % Dynare is free software: you can redistribute it and/or modify 0007 % it under the terms of the GNU General Public License as published by 0008 % the Free Software Foundation, either version 3 of the License, or 0009 % (at your option) any later version. 0010 % 0011 % Dynare is distributed in the hope that it will be useful, 0012 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0014 % GNU General Public License for more details. 0015 % 0016 % You should have received a copy of the GNU General Public License 0017 % along with Dynare. If not, see <http://www.gnu.org/licenses/>. 0018 candidates = table(strmatch(key,table(:,2),'exact'),:); 0019 if nargin == 2 0020 indices = cell2mat( candidates(:,1) ); 0021 return; 0022 end 0023 indices = candidates(strmatch(value, candidates(:,3), 'exact'),1); 0024 indices = cell2mat(indices);