Home > atmlab > handy > rqre_nargin.m

rqre_nargin

PURPOSE ^

RQRE_NARGIN Checks if minimum number of input arguments is reached

SYNOPSIS ^

function rqre_nargin( nreq, narg )

DESCRIPTION ^

 RQRE_NARGIN   Checks if minimum number of input arguments is reached

    If the required minimum number of input arguments is three, the
    function should normally be used as:

        rqre_nargin( 3, nargin );

    An error is issued if the requirement not is met (in contrast to
    nargchk that just returns an error message).

 FORMAT   rqre_nargin( nreq, narg )
        
 IN    nreq   Number of required arguments.
       narg   Number of input arguments.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

rqre_nargin.m

SOURCE CODE ^

0001 % RQRE_NARGIN   Checks if minimum number of input arguments is reached
0002 %
0003 %    If the required minimum number of input arguments is three, the
0004 %    function should normally be used as:
0005 %
0006 %        rqre_nargin( 3, nargin );
0007 %
0008 %    An error is issued if the requirement not is met (in contrast to
0009 %    nargchk that just returns an error message).
0010 %
0011 % FORMAT   rqre_nargin( nreq, narg )
0012 %
0013 % IN    nreq   Number of required arguments.
0014 %       narg   Number of input arguments.
0015 
0016 % 2005-03-16   Created by Patrick Eriksson.
0017 
0018 
0019 function rqre_nargin( nreq, narg )
0020                                                                             %&%
0021                                                                             %&%
0022 %- Checks                                                                   %&%
0023 %                                                                           %&%
0024 assert( istensor0( nreq )  &&  nreq >= 0 );                                 %&%
0025 assert( istensor0( narg )  &&  narg >= 0 );                                 %&%
0026 
0027 
0028 if narg < nreq
0029   [st,i] = dbstack;  
0030   error( 'The function *%s* requires at least %d arguments.', ...
0031                                                           st(i+1).name, nreq );
0032 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005