What is the computational cost of an nargin check?

1 次查看(过去 30 天)
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

采纳的回答

Stephen23
Stephen23 2014-9-6
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by