www.gusucode.com > external 工具箱matlab源码程序 > external/interfaces/webservices/http/+matlab/+net/+http/+internal/nargoutWarning.m

    function varargout = nargoutWarning(nargout,cfilename,fcn)
% If called with 3 args, warn about forgetting to save return value if nargout == 0.
% If called with 1 arg, set the warning mode on or off and return old warning
% mode.

% Copyright 2016 The MathWorks, Inc.

    % Turned on only during development
    persistent warningMode;
    if isempty(warningMode)
        % Warn if a file named "warnOnNargout" appears in this file's directory.  We
        % don't ship this file.  This expression replaces the file name in our path
        % with "warnOnNargout".  
        fs = ['\' filesep];  % Windows filesep is \ so must escape
        warningMode = exist(regexprep(mfilename('fullpath'), [fs '[^' fs ']+$'], [fs 'warnOnNargout']), ...
                            'file') ~= 0;
    end
    if nargin == 1
        % nargout is the desired warning mode
        varargout{1} = warningMode;
        warningMode = nargout;
    elseif warningMode
        if nargout == 0
            warning(message('MATLAB:http:MissingArgout', cfilename, fcn));
        end
    end
end