function mexdebug(arg)
%MEXDEBUG Debug MEX-files. 
%   MEXDEBUG ON enables MEX-file debugging.
%   MEXDEBUG OFF disables MEX-file debugging.
%   MEXDEBUG STOP returns to debugger prompt.
%   MEXDEBUG PRINT displays MEX-file debugging information.

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.5 $  $Date: 1997/11/21 23:32:18 $

warning('MEXDEBUG is obsolete.  Use DBMEX instead.')

% in VMS you don't run MATLAB with the debugger
if any(getenv('MATLAB_DEBUG')) | isvms 
    if nargin < 1, arg = 'on'; end
    if strcmp(arg,'stop')
        system_dependent(9);
    elseif strcmp(arg,'print')
        system_dependent(8,2);
    else
        system_dependent(8,strcmp(arg,'on'));
    end
else
    disp(' ')
    disp('In order to debug MEX-files, MATLAB must be run within a debugger.');
    disp(' ')
    disp('    To run MATLAB within a debugger start it by typing:');
    disp('           matlab -Ddebugger');
    disp('    where "debugger" is the name of the debugger you wish to use.');
    disp(' ')
end
