arrays with octave-java

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

arrays with octave-java

Ernst Reissner
Hi all,
i use octave-java 1.2.8 for invoking java code from within octave.
Works well but now i have some strange problem.

arr is an array.
I thought that i could write just arr.length, but does not work.
Then i tried java_get(arr,'length') which did not work either.
What did work is by reflection:
java_invoke('java.lang.reflect.Array', 'getLength', arr);

This seems overkill to me.

How to get a smooth solution?

regards,
ERnst
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: arrays with octave-java

PhilipNienhuis
Ernst Reissner wrote
Hi all,
i use octave-java 1.2.8 for invoking java code from within octave.
Works well but now i have some strange problem.

arr is an array.
I thought that i could write just arr.length, but does not work.
Then i tried java_get(arr,'length') which did not work either.
What did work is by reflection:
java_invoke('java.lang.reflect.Array', 'getLength', arr);

This seems overkill to me.

How to get a smooth solution?
If arr is a java array, you could do:
javamethods (arr)
to get a list of Java methods that can be invoked on arr in the object.method() fashion.

Philip