Here is a possible implementation of a linspace function written in MATLAB that uses nargin checks:
main.m613 chars23 linesThis mylinspace function checks the number of input arguments using the narginchk function with the minimum and maximum number of arguments allowed. If only two arguments are given, the function generates 100 equally spaced points by default. If three arguments are given, the third argument is the number of points requested. The function then calls the built-in linspace function with the input arguments and returns the result.
gistlibby LogSnag