function [input,inpidx,table] = multlchk(input,inpidx,table)
%MULTLCHK checks input to MULTLINR for correctness.
%       [INPUT,INPIDX,TABLE] = MULTLCHK(INPUT,INPIDX,TABLE)
%       ensures that all of the arguments to MULTLINR are appropriate.

%       Copyright (c) 1990-93 by The MathWorks, Inc.
%       $Revision: 1.4 $  $Date: 1993/06/09 22:09:40 $
%       Wes Wang 1/16/93

tmp = find(inpidx<=0);
if ~isempty(tmp)
   error('All elements in INPIDX must be greater than zero');
end;
if sum(inpidx) ~= length(input)
   error('The dimention of INPUT must be specified in INPIDX');
end;
tmp = 1;
for i = 1:length(inpidx)
   tmp = tmp * inpidx(i);
end;
if tmp ~= length(table);
   error('The dimention of TABLE does not match INPUT');
end;
tmp = 1; tend = inpidx(1);
for i=1:length(inpidx)
   if any(diff(input(tmp:tmp+inpidx(i)-1)) <= 0)
      error('Each index in INPUT must increase monotonically');
   end;
   tmp = tmp + inpidx(i);
end;



