I'm attempting to read timeseries data generated from a Simulink run using the Compiler SDK to generate a java jar which reads the mat file and passes the object back to the java runtime. the method is simple:
function myData = loadMatlabFile(myPath,varName)
fprintf("Loading %s from %s\n",varName,myPath);
myData = load(myPath,varName);
end
And this gets compiled to a java jar and included in a java project of mine. So this successfully returns an object, but I'm having challenges getting down to the data. So the output data are buses from the simulation, so they get put into a nested struct where the actual data are stored as a timeseries object:
>>structPath.toMyData.myTSObject
timeseries
Common Properties:
Name: 'myTSObject'
Time: [1737x1 double]
TimeInfo: [1x1 tsdata.timemetadata]
Data: [1737x1 double]
DataInfo: [1x1 tsdata.datametadata]
More properties, Methods
When I look at what I think the corresponding object is in java, I see this from toString()
Matlab2Java converter = new Matlab2Java();
myObj = converter.loadMatlabFile(1,myPath,myVar);
MWStructArray data = (MWStructArray)((MWStructArray) myObj[0]).getField("structPath",1);
MWArray toMyData = data.getField("toMyData",1);
MWArray myTSObject = ((MWStructArray) toMyData).getField("myTSObject",1);
It recognizes it as a MWNumericArray, but it appears to be empty. So my question is, am I accessing the data incorrectly, or is there no support for reading timeseries data in java?