function enabledberror( hasDBError, dbstat )
%ENABLEDBERROR turns on "dbstop if error" if hasDBError is true.

%   Copyright 1984-2002 The MathWorks, Inc.
%   $Revision: 1.4.4.1 $  $Date: 2004/12/20 16:45:12 $

if (hasDBError && ~isempty(dbstat))
    if (any(strcmp({dbstat.cond},'error')))
        dbstop if error;
    end
    if (any(strcmp({dbstat.cond},'caught error')))
        dbstop if caught error;
    end
end

