findactn.m
Upload User: haiyisale
Upload Date: 2013-01-09
Package Size: 3246k
Code Size: 1k
Category:

Wavelet

Development Platform:

Matlab

  1. function [tnrank,nodes] = findactn(t,varargin)
  2. %FINDACTN find active nodes.
  3. %   ST = FINDACTN(T) returns the status for all nodes of T.
  4. %   M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 01-Jun-98.
  5. %   Last Revision: 22-May-2003.
  6. %   Copyright 1995-2004 The MathWorks, Inc.
  7. %   $Revision: 1.5.4.2 $  $Date: 2004/03/15 22:38:18 $
  8. nbin = length(varargin);
  9. switch nbin
  10.   case 0 , nodes = allnodes(t); type = 'flag'; 
  11.   case 1 , nodes = varargin{1}; type = 'flag';
  12.   case 2 , nodes = varargin{1}; type = varargin{2};
  13. end
  14. order = t.order;
  15. spsch = t.spsch;
  16. nodes  = depo2ind(order,nodes);
  17. tnrank = istnode(t,nodes);
  18. i_loc  = locnumcn(nodes,order);
  19. act    = spsch(i_loc);
  20. i_Root = find(nodes==0);
  21. if ~isempty(i_Root) && order>0 , act(i_Root) = true; end
  22. switch type
  23.   case 'a'      , indic =  act; 
  24.   case 'a_tn'   , indic =  act & (tnrank>0);
  25.   case 'a_ntn'  , indic =  act & (tnrank==0);
  26.   case 'na'     , indic = ~act & (tnrank>0);   % always <==> 'na_tn'
  27.   case 'na_tn'  , indic = ~act; 
  28.   case 'na_ntn' , indic = ~act & (tnrank==0);  % always empty !!
  29.   otherwise     , tnrank(~act) = NaN; return
  30. end
  31. tnrank = tnrank(indic);
  32. nodes  = nodes(indic);