function [sys,varargout] = minreal_(sys,tol,dispflag)
% Note: DISPFLAG=true only for single state-space models

% Copyright 1986-2014 The MathWorks, Inc.
no = nargout-1;
Data = sys.Data_;
if dispflag
   Nx0 = order(Data);
end
for ct=1:numel(Data)
   [Data(ct),varargout{1:no}] = minreal(Data(ct),tol);
end
sys.Data_ = Data;
if dispflag
   % Print number of eliminated states
   Nrm = Nx0-order(Data);
   if Nrm>0
      if Nrm==1,
         xchar = 'state';
      else
         xchar = 'states';
      end
      fprintf('%d %s removed.\n',Nrm,xchar)
   end
end