Converting a Java double[] to a MATLAB vector

3 次查看(过去 30 天)
I have Java code that I use in MATLAB, and I would like to convert between my custom Java Vector class and MATLAB vectors. MATLAB will automatically convert a MATLAB vector into a Java double[], which means that if my Vector class has the following constructor:
public Vector(double[] arr);
then I can write the following in MATLAB:
myJavaVec = Vector([1, 2, 3]);
This is excellent. I'd also like to go from my Java Vector to a MATLAB vector. Currently, I can do this via the following:
matlabVec = cell2mat(cell(myJavaVec.getAsJavaArray()));
I need only create the following function in my Java Vector class:
public double[] getAsJavaVector();
Is there any way to make this code even more concise? Ideally, I could have the following:
matlabVec = myJavaVec.getAsMATLABVector();

回答(0 个)

类别

Help CenterFile 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