I have two similar models implementing the same amount of computation but taking different amounts of time to simulate. The models use an EML block to perform most of the calculations on a given set of data. The difference lies in the way large matrices are passed into the EML block. The two methods are:
a) Load data within Embedded MATLAB function block using LOAD declared as extrinsic.
b) Load data in MATLAB base workspace and then pass it on to the Embedded MATLAB Function block through its argument list as a parameter.
The simulation speed is slower when data is read from the MATLAB base workspace and passed into the EML block as an argument.
a) The elapsed time is 11.531966 seconds when running txad1.mdl
b) The elapsed time is 128.039013 seconds when running txad1_m.mdl
The degradation of simulation time is almost a factor of 10.
Best Answer