How do you access a single value returned from a JA builder jar

1 次查看(过去 30 天)
I have a matlab function that returns a single value (or a 1x1 Double)
I have built it into a Jar using JA builder and am calling it from a test java program.
The return type when called from Java is a java.lang.Object[1] - fine so far
When I convert it to using ((MWNumericArray)retVal[0]).getDoubleData() I get a double[0] array!!
There is no value
What am I doing wrong?

采纳的回答

Kevyn
Kevyn 2013-6-5
I figured out why it was happening - I was passing in my input parameters as java types and assuming that they would be converted.
If I do the conversion myself then the I get a sensible return value that I can access using ((MWNumbericArray)retVal[0]).getDouble()

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Java Package Integration 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by