%
%  c = inpcomp( G, ip );
%
%  Returns the complement set of inputs described in ip. All input indices
%  not in ip. Example: Number of inputs is four and ip=[2 3]; then c=[1 4];
% 
%  Inputs:  G  - Matrix describing the system, can bd system, constant or 
%                varying.
%           ip - Set of inputs to be complemented.
%
%  Outputs: c  - complement set.
%
%  Written by: Kjetil Havre, e-mail: kjetil@ife.no
%  
%  Note: This is for sure not the most effective way to find the complemet 
%        set in matlab.
%

function c = inpcomp( G, ip )
   c = [];
   [mt, rd, cd, nd] = minfo(G);
   no = max(size(ip));
% Added 9/8-95 KH
   if strcmp(ip,':') == 1 
      return
   end
% to this spot 9/8-95.
   if no <= cd
      ipc = [];
      for i=1:cd,                     
	 found = 0;
	 for j=1:no,
	    if ip(j) == i;
	       found = 1;
	    end
	 end
	 if found == 0
	    ipc = [ipc i];
	 end
      end
      c = ipc;
   else
      disp('Number of outputs is larger than columns' );
      return;
   end
end
