Here's an implementation of the linspace() function that checks for the number of input arguments (nargin), whether they are numeric (isnumeric()) and whether scalar values are passed (isscalar()):
main.m797 chars30 linesThis implementation uses the error() function to throw errors when an invalid input argument is passed. It also sets a default value of 100 for the number of values if it is not provided as an input argument.
gistlibby LogSnag