nargin counts the number of input arguments for a function.
mod(x,2) returns 1 when x is odd.
if mod(nargin,2)~=1
error('There must be an odd number of inputs.')
end
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!