Effacer les filtres
Effacer les filtres

Passing struct from Java to Matlab

2 vues (au cours des 30 derniers jours)
Torsten Knüppel
Torsten Knüppel le 9 Avr 2019
Dear all,
I would like to create a Matlab struct in Java and then pass it to Matlab.
To do this, I created the following member function of my already existing class:
public Struct pollMatlab(){
return new Struct("p", 2, "q", 3);
}
This was inspired by the documentation here.
I also imported the packages
import com.mathworks.engine.*;
import com.mathworks.matlab.types.*;
However, when I call the function, I don't get a nice struct, but an object of type
com.mathworks.matlab.types.Struct@...
The keys and values contained in this object are as expected. I then tried to convert the java-object to its Matlab equivalent by simply using struct (inspired from the documentation here). This, however, yields an empty struct.
I have the feeling that using the matlab.types.Struct should immediately lead to a proper Matlab struct. Am I missing something?
Any help would be greatly appreciated.
Best regards
Torsten Knüppel

Réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by