Is it possible to use command syntax in static methods or packaged functions?
이전 댓글 표시
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
Duc Le
2022년 2월 5일
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
2022년 2월 5일
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
2022년 2월 6일
Dave White
2022년 2월 6일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!