home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS2.DI$ / COMPLE.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  482 b   |  20 lines

  1. % function vecout = comple(vecin,n)
  2. %   VECOUT is the complementary (to VECIN) set of
  3. %   integers, with respect to the set 1:n. VECOUT
  4. %   is returned as a row vector. subroutine for
  5. %   INDVCMP.
  6.  
  7. function out = comple(in,n)
  8.  in = sort(in);
  9.  out = [];
  10.  lout = n - length(in);
  11.  if in(1) ~= 1;
  12.    out = 1:in(1)-1;
  13.  end
  14.  for i=2:length(in)
  15.    out = [out in(i-1)+1:in(i)-1];
  16.  end
  17.  out = [out (in(length(in))+1):n];
  18. %
  19. % Copyright MUSYN INC 1991,  All Rights Reserved
  20.