%
%  Mo = selc(M,r,c);
%
%  Selects rows and columns of M as described in r and c. This is similar 
%  to sel. However it works on constant matrices. 
%

function Mo = selc(M,r,c)
   if strcmp(r, ':') == 1
      Mr = M;
   else
      Mr = [];
      for i=1:max(size(r))
         Mr = [Mr; M(r(i),:)];
      end
   end
   if strcmp(c, ':') == 1
      Mo = Mr;
   else
      Mo = [];
      for i=1:max(size(c))
         Mo = [Mo Mr(:,c(i))];
      end
   end
end
