MATLAB: If there is any way to call a function of the same name but less arguments.
function
e.g we have a functiondemo( arg1, arg2) { . . }end
now calling the same function with more arguments demo(arg1,arg2,arg3)
I know it will generate error. But I want to know if there is any other way to do this.
Best Answer
If the function already exists, and you cannot modify it, then no. As you said yourself, it will generate an error. You cannot pack 3 pounds of "stuff" into a 2 pound bag. The same applies to arguments of functions.
Note that the reverse will sometimes work, you can (sometimes) call a function that requires 3 arguments, passing in only the first two of them, IF the function is coded to handle that eventuality.
It indicates that there is no function by the name that you called for inputs of the logical type. So either you called a function that does exist, but you called it with an input that it didn't expect, or there just is no such function.
Best Answer