function Z_delete = delete_sources(Z , D , ind_D , M);
% Delete sources from the observation given
%
% 1) D the time interval to exclude the source
% 2) the number of the sources%
%
% Usage
% ----
%
% Z_delete = delete_sources(Z , D , ind_D , M);
%
% Inputs
% -----
%
% Z The observation
% D (2 x r x l) , r Number of exclusion zones, l number of source to delete l <= M;
% ind_M (1 x l)
% M Total number of the sources
%
% Example
% ------
%
%
% D = cat(3 , [200 , 500 ; 350 , 700 ] , [200 , 500 ; 350 , 700 ]);
% ind_D = [1 , 3];
% M = 3;
% Z_delete = delete_sources(Z , D , ind_D , M);
%
%
%
%***************************************************************************%%
% Auteur Sbastien PARIS (sebastien.paris@lsis.org), Septembre 2002 %
%***************************************************************************%%
[mtM , nx2] = size(Z);
[h , r , l] = size(D);
Z_delete = Z;
if(h ~= 2)
error('D must be (2 x r x l) ');
end
diff_D = diff(D , [] , 1);
for i = 1 : l
for j = 1:r
if( (diff_D(i) ~= 0) && (D(1 , j , i)~=0) )
% ind = find( (Z_delete(: , 1) >= D(1 , j , i) ) & ( Z_delete(: , 1) <= D(2 , j , i)) & (Z_delete(: , nx2) == ind_D(i)));
ind = ( (Z_delete(: , 1) >= D(1 , j , i) ) & ( Z_delete(: , 1) <= D(2 , j , i)) & (Z_delete(: , nx2) == ind_D(i)));
Z_delete( ind , :) = [];
end
end
end