function varargout = dspblkadpt(action)
% DSPBLKADPT Mask dynamic dialog function for adaptive filters

% Copyright 1995-2000 The MathWorks, Inc.
% $Revision: 1.3 $ $Date: 2000/04/29 22:54:31 $

blk=gcb;
if nargin==0, action = 'dynamic'; end

switch action
   case 'init'
      % The fifth dialog (checkbox) adds an enable port to the block
      % - Port means we can externally drive the enable port
      % - Constant means the enable port is removed
      
      adaptBlk      = [blk '/Adapt'];
      portIsPresent = strcmp(get_param(adaptBlk,'BlockType'),'Inport');
      wantPort      = strcmp(get_param(blk,'Adapt'),'on');
      
      if wantPort & ~portIsPresent,
         % Change Constant to Port
         pos = get_param(adaptBlk,'Position');
         delete_block(adaptBlk);
         add_block('built-in/Inport',adaptBlk,'Position',pos);
         
      elseif ~wantPort & portIsPresent,
         % Change Port to Constant
         pos = get_param(adaptBlk,'Position');
         delete_block(adaptBlk);
         add_block('built-in/Constant',adaptBlk,'Position',pos,'Value','1');
      end
      
      
   otherwise
      error('unhandled case');
end

% end of dspblkadpt.m
