Say I have a dummy function with two arguments. Arguments can have default values if they are not included in the function call. But how do I know arguments are not provided?
I know I can use nargin like this
function dummy(arg1, arg2) if nargin < 2 arg2 = 0; end if nargin < 1 arg1 = 0; end % function body
I want to know if I can check if arguments are provided based on the argument name? Something like supplied(arg2) == false .
I ask this because sometimes I want to add new arguments at the top of the argument list (since it may not have a default value), and then I need to change everything if nargin ... If I can check by name, nothing needs to be changed.
matlab
fefe Dec 21 '11 at 13:22 2011-12-21 13:22
source share