# checkNumArgs

## PURPOSE

Helper utility for checking numeric vector arguments.

## SYNOPSIS

function [ x, er ] = checkNumArgs( x, siz, intFlag, signFlag )

## DESCRIPTION

     Helper utility for checking numeric vector arguments.

     Runs a number of tests on the numeric array x.  Tests to see if x has all
     integer values, all positive values, and so on, depending on the values
     for intFlag and signFlag. Also tests to see if the size of x matches siz
     (unless siz==[]).  If x is a scalar, x is converted to a array simply by
     creating a matrix of size siz with x in each entry.  This is why the
     function returns x.  siz=M is equivalent to siz=[M M]. If x does not
     satisfy some criteria, an error message is returned in er. If x satisfied
     all the criteria er=''.  Note that error('') has no effect, so can use:
      [ x, er ] = checkNumArgs( x, ... ); error(er);
     which will throw an error only if something was wrong with x.

     USAGE
      [ x, er ] = checkNumArgs( x, siz, intFlag, signFlag )

     INPUTS
      x           - numeric array
      siz         - []: does not test size of x
                  - [if not []]: intended size for x
      intFlag     - -1: no need for integer x
                     0: error if non integer x
                     1: error if non odd integers
                     2: error if non even integers
      signFlag    - -2: entires of x must be strictly negative
                    -1: entires of x must be negative
                     0: no contstraints on sign of entries in x
                     1: entires of x must be positive
                     2: entires of x must be strictly positive

     OUTPUTS
      x   - if x was a scalar it may have been replicated into a matrix
      er  - contains error msg if anything was wrong with x

     EXAMPLE
      a=1; [a, er]=checkNumArgs( a, [1 3], 2, 0 ); a, error(er)

     See also NARGCHK

     Piotr's Image&Video Toolbox      Version 2.0
     Copyright 2008 Piotr Dollar.  [pdollar-at-caltech.edu]
     Please email me if you find bugs, or have suggestions or questions!
     Licensed under the Lesser GPL [see external/lgpl.txt]

## CROSS-REFERENCE INFORMATION

This function calls:

This function is called by:

- confMatrix Generates a confusion matrix according to true and predicted data labels.
- meanShiftIm Applies the meanShift algorithm to a joint spatial/range image.
- imShrink Used to shrink a multidimensional array I by integer amount.
- maskGaussians Divides a volume into softly overlapping gaussian windows.
- nonMaxSuprList Applies nonmaximal suppression to a list.
- nonMaxSuprWin Nonmaximal suppression of values outside of a given window.
- nlfiltersep Efficient multidimensional nonlinear but seperable filtering operation.
- arrayCrop Used to crop a rectangular region from an n dimensional array.
- arrayToDims Pads or crops I appropriately so that size(IC)==dims.
- mat2cell2 Break matrix up into a cell array of same sized matrices.
- tocStatus Used to display the progress of a long process.