%thresh_det 
%setting threshold for Block Pursuit
[N,hz]=size(z);

[~, ~, ~,ener]=spl_WP_anaP2D(z,Par,levels);%wavelet packet transform of the input and calcultion of energies 
%in blocks of the coefficients
clear wvtran wctran entro
lis=List_BP(ener);
[vli ,hli]=size(lis);
figure;plot((levels+1):vli,lis((levels+1):vli,end));
xlabel('SETTING THRESHOLD FOR STOPPING RULE')
AA=[
    'TO CHANGE THRESHOLD: click the plot by data cursor for threshold,'
    'then export cursor data to the workspace and type any number>0;  '
    'OTHERWISE: type 0                                                '
    ];
    %disp(AA)
    title(AA)
tre1=input('any number>0;0--former; ?')
 if tre1~=0
     
     %u(1)=cursor_info.Position(2)
tre=cursor_info.Position(2)

     
         %tre=[1: tre];
     
  eval(['save TRE' int2str(BbP)  '  tre'])  
 else
     eval(['load TRE' int2str(BbP)])
 end
 close
 % Copyright (c) 2013. Valery A. Zheludev 