Code covered by the BSD License  

Highlights from
Warning message for debugging/development

Warning message for debugging/development

by

 

Issues warning that code has been changed temporarily for debugging/development purposes.

dbwarn(varargin)
function [] = dbwarn(varargin)
%
% dbwarn.m--Warns user that code has been temporarily changed for debugging
% purposes. Place call to dbwarn in m-file being modified.
%
% Optional input argument is string for indicating reason for warning.
%
% Syntax: dbwarn(<mssgStr>)
%
% e.g.,   dbwarn
% e.g.,   dbwarn('Temporary value for i')

% Developed in Matlab 7.4.0.336 (R2007a) on GLNX86.
% Kevin Bartlett (kpb@uvic.ca), 2007-11-13 16:13
%-------------------------------------------------------------------------

if nargin == 0
    mssgStr = '';
else
    mssgStr = varargin{1};
end % if

DBstack = dbstack;

if length(DBstack) < 2
    disp('There is no point calling dbwarn.m from root workspace.');
else
    callingFcn = DBstack(2).file;
    
    if isempty(mssgStr)
        str = sprintf('%s%s',callingFcn, '--Code temporarily changed for development/debugging purposes.');
    else
        str = sprintf('%s%s\n   %s',callingFcn, '--Code temporarily changed for development/debugging purposes: ',mssgStr);
    end % if
    
    warning(str);
end % if

Contact us