1function a=indnv(x,y)
2
3% function a=indnv(x,y)
4% Finds the elements indices of one vector in an other one
5%
6% INPUTS
7%    x:         column vector
8%    y:         column vector
9%
10% OUTPUTS
11%    a:         vector of elements position of x in y
12%
13% SPECIAL REQUIREMENTS
14%    none
15
16% Copyright (C) 2001-2017 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
33a = zeros(size(x)) ;
34
35for i = 1:size(x,1)
36    j = find( x(i) == y );
37    if isempty(j)
38        a(i) = NaN;
39    else
40        a(i) = j;
41    end
42end
43