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 1984-2000 The MathWorks, Inc. 
%   $Revision: 5.9 $  $Date: 2000/06/01 01:25:36 $

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

if any(getenv('MATLAB_DEBUG'))  
    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
