フィルターのクリア

Working with Kotlin companion object (for kotlin.time.Duration) in Matlab

9 ビュー (過去 30 日間)
Robert Dodier
Robert Dodier 2023 年 10 月 5 日
回答済み: Divyanshu 2023 年 12 月 21 日
I'm trying to create an instance of kotlin.time.Duration which represents 5 minutes. In Kotlin code I could write 5.minutes which, due to some helpful gyrations conducted behind the scenes, yields the duration expected. I am working from the assumption that Matlab doesn't understand Kotlin syntax and I have to help it figure out what methods to call on what objects.
The closest I have come so far is
>> javaMethod ('box-impl', 'kotlin.time.Duration', javaMethod ('minutes-UwyO8pc', kotlin.time.Duration.Companion, 5))
ans =
5m
which is pretty tremendously ugly and clumsy, but, still worse, depends on an automatically-generated method name minutes-Uwy08pc which can't be guessed without inspecting the jar file.
Is there a better way? Maybe I've overlooked something.

回答 (1 件)

Divyanshu
Divyanshu 2023 年 12 月 21 日
Hi Robert, probably there is no better way to interact with Kotlin from MATLAB.
As per the following documentation MATLAB provides external Interface only for the languages mentioned and not for 'Kotlin':
Thanks.

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by