MATLAB: What is the computational cost of an nargin check

computational costfor loopif statementMATLAB

I have a program that invokes a function a lot of times in a for loop. In that function I have to check the number of input arguments with an if statement. Does this remarkably influences the run-time? That specific function (which is invoked in the for loop) is a general purpose function so input check is needed.
Thank you, Zoli

Best Answer

Measure it: use either the profiler, or tic/toc . Make the loop do enough iterations to really create measurable times, and see what including/removing nargin does to the runing time.
Related Question