function [i,ty,n]=issytem(x)
%  [I,TY,N]=ISSYSTEM(X) checks whether or not X is a system created by
%  the function MKSYS.  If X is a system, then 
%                I    =  1
%                TY   =  system type
%                N    =  number of matrices in the system (depends on TY)
%  Otherwise, I=0, TY=[] and N=0.

i=0;
ty=[];
n=0;
[j,b]=istree(x,'ty');
sysmagic=27591;
if j,
  if x(4)==sysmagic,
     i=1;
     ty=b;
     [junk,n]=vrsys(ty);
  end
end

