MATLAB: Using matlab java package in Java

java mcc arguments-passing

Hi everyone, I implemented 2 function in matlab. The first function returns an array of cell objects, an array of integers and a single integer:
[cell_object, idarray,n] = function1(); the second functions takes in input this 3 value: function2(cell_object,idarray,n);
In matlab I don't have any problems. I compiled this code for Java Package (using mcc -W 'java:…' etc.). After I got a package with 2 classes, one class for function (Class1 for function1 and Class2 for function2), each class contains a method called as the name of its function.
My question is, in Java how to get the output parameters from the first function and pass them to the second function? I tried to do this: Object[] params = class1.function1(0); class.function2(null,params); but params is empty after the call of function1().
I have another quastion. Is possible in Matlab define 2 function in the same .m file and compile it as java package obtaining one class with 2 method? I want to make global variable in the 2 function, so I can work in java without pass arguments between the 2 methods.
Thanks

Best Answer

I solved. The problem was that the function wants in input also the number of the output parameters. Object[] params = class1.function1(3); 3 is number of output variables