How can I pass a ragged array of Java primitive types to a Java function from MATLAB?

I want to pass a nonrectangular array of doubles to a function that is a member of a Java class. A Java function can return a ragged array to MATLAB which is then converted to a cell array, but I cannot pass this array back to a Java function.
An example of a ragged array is:
A= [1 2 3;
4 5;
6 7 8]

 채택된 답변

The ability to create Java primitive types is not available in MATLAB.
It is possible to create ragged arrays of Java objects by creating the Java objects and concatenating them together. For example, you can create a ragged array of the Java "Double" class as follows:
A=[java.lang.Double(1) , java.lang.Double(2) , java.lang.Double(3) ;
java.lang.Double(4) , java.lang.Double(5) ;
java.lang.Double(6) , java.lang.Double(7) , java.lang.Double(8)]

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Call Java from MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by