Is it possible to use command syntax in static methods or packaged functions?
Show older comments
I am building an API that I would like to use from command prompt frequently. The API has several static methods that have one string input. I would like to be able to call these methods from the prompt using command syntax, eg:
MyClass.myMethod arg1
or, alternatively, I would like to be able to do the same, but via functions in a package, eg:
MyPackage.wrapperForMyMethod arg1
However, neither of these seem to work. I am wondering if there is any special way to enable command syntax in either of these cases.
4 Comments
Duc Le
on 5 Feb 2022
I asked the same question recently (sorry I didn't see yours before), and just got an answer back from Mathworks. Basically they said they don't support using command syntax on fully qualified package or class signatures but "it might be considered for future releases".
At the moment, if you have a package, you can do:
import MyPackage.wrapperForMyMethod % or import MyPackage.*
wrapperForMyMethod arg1
Unfortunately, there is no work-around for static class methods.
Rik
on 5 Feb 2022
Why would you want this? Using the function syntax allows many code helping tools to work properly. What would be the benefits of this syntax?
Dave White
on 6 Feb 2022
Dave White
on 6 Feb 2022
Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!