function E=calce(net,Ac,T,TS)
%CALCE Calculate network error.
%
%	Synopsis
%
%	  calce(net,Ac,T,TS)
%
%	Warning!!
%
%	  This function may be altered or removed in future
%	  releases of the Neural Network Toolbox. We recommend
%	  you do not write code which calls this function.

% Mark Beale, 11-31-97
% Copyright (c) 1992-1998 by The MathWorks, Inc.
% $Revision: 1.3 $

E = cell(net.numLayers,TS);
delays = net.numLayerDelays;

for ts = 1:TS
  for i=net.hint.targetInd;
    E{i,ts} = T{i,ts} - Ac{i,ts+delays};
  end
end
