function [stat,post] = blkl2interp(path,prop,bstr,bint,bflt,parent,name,catalog,ws,node)
%BLKL2INTERP Given sets of input and output breakpoints, this block performs bilinear
%     interpolation on two input variables.
%
% See also BLKC1INTERP, BLKL1INTERP, BLKS1INTERP, BLKS2INTERP.

% Initial coding by A S Bozin, 7-1-97
% Copyright 1997-2000 The MathWorks, Inc.
% $Revision: 1.6 $ $Date: 2000/06/14 16:09:38 $

   stat = 0;			   		   % Error flag
   nInputs = bint(5);
   nOutputs = bint(6);
   %
   % Add mux and demux blocks if necessary
   %
   channels = [nOutputs nOutputs];
   [post,rect] = blkio('port',channels,nOutputs,prop,path);
   %
   % Get the input and output breakpoints
   %
   indFlt = bint(16);
   indStr = bint(17)+1;
   indInt = bint(18)+1;
   indInt = bint(indInt)+indInt;		   % Skip icon data
   nColumns = bint(indInt);
   nRows = bint(indInt+1);
   indInt = bint(15)+1;
   npar = 3;					   % Number of parameters
   symInd = zeros(1,npar);
   if (bitand(bint(indInt),16))
      indVar = indInt+2;
      vRange = 1:bint(indVar);
      symInd(bint(indVar+vRange)) = 1;
   end
   rDims = [nColumns;nRows;nColumns];
   cDims = [1;1;nRows];
   ub = cumsum(rDims.*cDims);
   lb = [0;ub(1:end-1)]+1;
   str = cell(npar,1);
   for (k = find(symInd))
      ind = mfindstr(bstr,indStr,'|');
      str{k} = bstr(indStr:ind-1);
      indStr = ind+1;
   end
   %
   % Get the block parameter variables
   %
   [symInd,str] = mgetscope(symInd,str,catalog,ws,node);
   for (k = find(~symInd))
      points = zeros(rDims(k),cDims(k));
      bRange = lb(k):ub(k);
      points(:) = bflt(indFlt+bRange);
      str{k} = mat2char(points');
   end
   %
   % Bilinear interpolation block.
   %
   bh = add_block('libsb2sl/NTP/BiLinearInterp',path,...
		  'ForegroundColor',prop.fgColor,...
		  'BackgroundColor',prop.bgColor,...
		  'Orientation',prop.orientation,...
		  'DropShadow',prop.border,...
		  'Position',rect,...
		  'in1BrkPoints',str{1},...
		  'in2BrkPoints',str{2},...
		  'outBrkPoints',str{3});
   %
   % Connect the current bilinear interpolation block with the mux and demux blocks
   %
   blkio('line',channels,nOutputs,post,parent,name);
   return					   % Last card of BLKL2INTERP
