function [stat,post] = blkgainlist(path,prop,bstr,bint,bflt,parent,name)
%BLKGAINLIST This block defines a matrix gain multiplication function where the gain values
%     are selected from a list of gains.
%
% See also BLKGAIN, BLKC1INTERP.

% Initial coding by A S Bozin, 6-15-98
% Copyright 1997-2000 The MathWorks, Inc.
% $Revision: 1.4 $ $Date: 2000/06/14 16:09:22 $

   stat = 0;			   		   % Error flag
   nInputs = bint(5);
   nOutputs = bint(6);
   %
   % Add mux and demux blocks if necessary
   %
   ny = nOutputs;
   nu = nInputs-1;
   channels = [1 nu];
   [post,rect] = blkio('port',channels,nOutputs,prop,path);
   %
   % Get the input and output breakpoints
   %
   indInt = bint(15)+1;
   indStr = bint(17)+1;
   mode = bint(indInt);
   if (bitand(mode,2))
   end
   indInt = bint(18)+1;
   indInt = bint(indInt)+indInt;		   % Skip icon data
   nGainPts = bint(indInt);
   indInt = indInt+1;
   nIndices = bint(indInt);
   cRange = 1:nIndices;
   iInd = bint(indInt+cRange);
   indInt = indInt+nIndices;
   jInd = bint(indInt+cRange);
   npar = 2;					   % Number of parameters
   symInd = zeros(1,npar);
   str = cell(npar,1);
   %
   % Get the block parameter variables
   %
   indFlt = bint(19)+1;				   % Skip over the tolerance
   points = zeros(1,nGainPts);
   pRange = 1:nGainPts;
   points(:) = bflt(indFlt+pRange);
   str{1} = mat2char(points);
   indFlt = indFlt+nGainPts;
   gains = zeros(ny,nu*nGainPts);
   ind = sub2ind([ny,nu],iInd,jInd);
   bias = ny*nu;
   for (k = 1:nGainPts)
      gains(ind) = bflt(indFlt+cRange);
      indFlt = indFlt+nIndices;
      ind = ind+bias;
   end
   str{2} = mat2char(gains);
   %
   % Gain scheduler block
   %
   bh = add_block('libsb2sl/LOG/GainScheduler',path,...
		  'ForegroundColor',prop.fgColor,...
		  'BackgroundColor',prop.bgColor,...
		  'Orientation',prop.orientation,...
		  'DropShadow',prop.border,...
		  'Position',rect,...
		  'IND',str{1},...
		  'GAIN',str{2});
   %
   % Connect the current gain scheduler block with the mux and demux blocks
   %
   blkio('line',channels,nOutputs,post,parent,name);
   return					   % Last card of BLKGAINLIST
