You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to load a dynamically sized array from a Matlab file. This is a similar issue to issue #34.
Below is a minimal example that fails. It looks like Dymola fails to expand the variable.
model MATTest2 "MAT-file read test"extends Modelica.Icons.Example;
innerparameter ExternData.MATFile dataSource(fileName=Modelica.Utilities.Files.loadResource("modelica://ExternData/Resources/Examples/test_v7.3.mat")) "MAT file"annotation(Placement(transformation(extent={{-80,60},{-60,80}})));finalparameterInteger m = dataSource.getArrayRows2D("table1") "Number of rows in 2D array";
parameterReal matTable[:,:] = dataSource.getRealArray2D("table1", m, 2);
annotation(experiment(StopTime=1), Documentation(info="<html><p>This example model reads the table parameter from variable table1 of the HDF5-based MAT-file <a href=\"modelica://ExternData/Resources/Examples/test_v7.3.mat\">test_v7.3.mat</a>. The table parameter is read as Real array of dimension 3x2 by function <a href=\"modelica://ExternData.dataSource.getRealArray2D\">ExternData.dataSource.getRealArray2D</a>. The read parameter is assigned by a parameter binding to the appropriate model parameter.</p></html>"));end MATTest2;
I've tested this in Dymola 2022x, and I get an error stating: Failed to expand the variable matTable
and its definition equation:
dataSource.getRealArray2D_Unique'"dataSource"'(
"table1",
m,
2,
dataSource.mat)
Is it possible to use parameter Real matTable[:,:] = dataSource.getRealArray2D(tableName, m, 2); instead of parameter Real matTable[:,:] = dataSource.getRealArray2D(tableName, 3, 2);
Is there a workaround for this? Any help here would be appreciated. Thank you for your time.
The text was updated successfully, but these errors were encountered:
Hi there,
I'd like to load a dynamically sized array from a Matlab file. This is a similar issue to issue #34.
Below is a minimal example that fails. It looks like Dymola fails to expand the variable.
I've tested this in Dymola 2022x, and I get an error stating:
Failed to expand the variable matTable
and its definition equation:
dataSource.getRealArray2D_Unique'"dataSource"'(
"table1",
m,
2,
dataSource.mat)
Is it possible to use
parameter Real matTable[:,:] = dataSource.getRealArray2D(tableName, m, 2);
instead ofparameter Real matTable[:,:] = dataSource.getRealArray2D(tableName, 3, 2);
Is there a workaround for this? Any help here would be appreciated. Thank you for your time.
The text was updated successfully, but these errors were encountered: