How to pass a 3d array double[][][] from java to a Matlab function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Felipe Reis
am 17 Aug. 2018
Kommentiert: James Tursa
am 23 Aug. 2018
I have a matlab function inside a jar package which is supposed to receive from my java class a double[][][]. Due the difference in the way java and matlab understand array structures when the array arrives to the matlab side it is messed.
Is there a way to convert java 3d array so then each dimension can be read like: (:,:,1) (:,:,2) and (:,:,3) in the matlab function?
0 Kommentare
Akzeptierte Antwort
James Tursa
am 17 Aug. 2018
As long as it arrives as a 3D variable but the dimensions seem backwards, perhaps you only need to permute it. E.g.,
x = 3D array from your java
x = permute(x,[3 2 1]); % permute to MATLAB memory ordering
2 Kommentare
James Tursa
am 23 Aug. 2018
Try permute(DS,[2 3 1]) to get rid of that extra transpose at the end.
The permute function does not add any elements to the input array. So if you are getting extra 0's they are there before the permute operation.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Java Package Integration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!