MATLAB: Recommended method for importing data in bus object format into a Rapid Accelerator simulation.

data importrapid acceleratorsimulink

Would very much appreciate recommendations / guidance on the below.
I wish to do the following:
  1. Run model1 (a physical system), log the simulation results.
  2. Run model2 (a monitoring system), importing the model1 results into model2
I would like model2 to run in rapid accelerator mode as I have many different tests scenarios from model1 to run through model2. The data being imported from model1 is always of the same format, but can be of different lengths (i.e. simulation times).
The model1 data is logged as a bus object and logged using signal logging + the dataset method (to logsout).
In model2, I import the logged data using the "Data Import/Export / load from workspace / input" field of the Configuration Parameters window using a command
logsout.getElement('myData');
I then import using a root level inport – which works fine in normal and accel, but not rapid accel mode. In rapid accel mode, I receive the error "Rapid accelerator only supports array or structure format".
I have also tried changing the root level inport to a "from workspace" block, but any changes to the length of the data it is pointing at trigger a rebuild, which I would like to avoid!
Comments and suggestions most welcome.
Martin.

Best Answer

A From File block supports reading a MAT file that is a struct of Timeseries as a bus array. Note that you will need to save the bus output from model1 in the v7.3 format:
myData = logsout.getElement('myData').Values;
save mydata.mat -v7.3 myData
Then in model2, replace the From Workspace with the From File block being sure to specify the appropriate bus object as the output data type.
I work at MathWorks and will pass along your feature request for Timeseries support of root level input ports in Rapid Accelerator mode.