Calling an object method where the name of the method is a varible

1 次查看(过去 30 天)
I am trying to call an object method when I have the object instance, the method name, and the argument value(s) as variables. If my object were a COM object, I could use invoke(). Is there something similar to this for user-defined classes? I'm trying to avoid using eval().

采纳的回答

Matt J
Matt J 2019-1-25
You can just do,
object.(methodname)(arg1,arg2,...)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Type Identification 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by