Assume I have an object X
of class MyClass
. MyClass
has a method compute
, and when I call U = compute(X,...)
, matlab automatically calls the class method. However, what I actually want is to call another function also called compute
whose parameters start with a MyClass
object though. How do I force matlab to call this regular function rather than go into the class method?
There is no way to do this without making some changes either to the function's name or location. If you check Matlab's function precedence order, methods always run before normal external functions. Your only practical options are:
private
in the same folder as your script file (item 5 on the list)UPDATE
Although not quite practical for smaller projects, you may also want to look into packaging your functions. A good discussion can be found in this SO post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With