% NN_get_kxv( k, path_index, el_index)
% - get subset of x,y and velocity values from Kalman kxv array
% where k selects track 1..K.
%
% For use by m_16.m, where path_index and el_index represent
% a particular value of el.
%
function r = NN_get_kxv( k, path_index, el_index)

global K;
global L;
global M;
global kxv;

if( (k < 1) | (k > K))
  error( '1 <= k <= K required');
end

N = length( path_index);

r = zeros(4,N);

for i = 1:N
  j = [1:4] + (el_index(i)-1)*4;
  i1 = k + ((i-1)*M + (path_index(i)-1))*K;
  r(:,i) = kxv(j,i1);
end

r = r';
