Can String automatically convert to MWNumericArray of type double?

1 回表示 (過去 30 日間)
FM
FM 2020 年 10 月 29 日
編集済み: FM 2020 年 10 月 29 日
Suppose a Java packaged MATLAB function accepts a MWNumericArray of MATLAB type double, e.g., this makesqr example function.
n = new MWNumericArray(Double.valueOf(args[0]),
theMagic = new Class1();
result = theMagic.makesqr(1, n);
It seems that a `String` object can automatically convert to the required MWNumericArray of type double, e.g., as in this alternative invocation of makesqr.
result = M.makesqr(1, arg[0]);
The argument arg[0] is described as a double, but it is in fact a String (step 16 on the source page).
The rules for conversion say: "A Java string is converted to a 1-by-N array of char with N equal to the length of the input string."
This is nonsensical for a function that expects a double, so it clearly doesn't apply to the example here.
Where do the conversion rules apply, if not during invocation of Java packaged MATLAB functions?
What rules do apply here, resulting in conversion of a Java String to a MATLAB double?

回答 (0 件)

カテゴリ

Help Center および File ExchangeJava Package Integration についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by