Possible memory corruption when running LINMOD

1 view (last 30 days)
All,
Attached is a .zip with a simple script and model that illustrates a possible memory corruption problem that I've run into in a larger system (NOTE: the .slx is saved in R2015b).
  1. Open both the .m and .slx
  2. run 'testSim_INIT.m' as is
  3. If you see some diverging signals on the scope then the simulation successfully ran
  4. Go to the last code section on 'testSim_INIT.m' and run just that section (click in section and CTRL+ENTER)
You should get the following error,
Expected an integer value, found an non-integer variable with value 1e-05 .
MATLAB Function 'MATLAB Function': var(:,i) = rand(6)*var(:,list(i));
^^^^^^^
Now, open the matlab function 'myTest' on the block diagram of 'testSim.slx'. Comment out the line,
list = model.list;
and uncomment the line,
list = (0:4);
Now, rerun steps 1-4. Notice that LINMOD now runs w/o error.
You can repeat these tests after toggling the manual switch on the block diagram to route 'In1' to the 'myTest' instead of the constant.
QUESTION/CONCLUSION:
It seems to me they there is a memory corruption as the error claims have received a non-integer value out of 'list(i)'. I have seen the exact same results in R2015a, R2015b and R2016b.
Am I simply missing something obvious?

Answers (0)

Community Treasure Hunt

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

Start Hunting!