if there is any way to call a function of the same name but less arguments.
7 次查看(过去 30 天)
显示 更早的评论
e.g we have a function demo( 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.
0 个评论
采纳的回答
John D'Errico
2015-3-16
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.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!