MATLAB: Check the number of input arguments of a function

functionsinput

Hey there, Im stuck on a question asking me to check the number of input arguments of a function written by me. It requires to check that the number of inputs are exactly n otherwise the function returns an error message. How do I write a code to achieve that?(No loops plz) And how do I make the function to display an error message? Thanks for answering!!

Best Answer

See the documentation for the varargin (link) function.
Related Question