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

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.
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?
Rik,
Same reason there exists a command syntax to begin with; convenience.
cd('to/my/path')
vs
cd to/my/path
Duc Le,
No problem. Just happy you answered my question!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2018a

질문:

2021년 12월 28일

댓글:

2022년 2월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by