Why do I receive a code generation assertion while generating code with MATLAB Function block?

I have a MATLAB function block which uses global data using Data Store Memory blocks. The model updates and simulates without any error. However, during code generation, it throws the following error:
Code generation assertion 'cg_tag(aVarExpr->var())->ptr != NULL && getCGVarDimSizeVar(aVarExpr->var()) != NULL' failed in 'b:\matlab\src\rtwcg\rtwcg_utils\rtwcg_dataconnector.cpp:479

 Accepted Answer

This issue has been resolved as of MATLAB R2017b.
For releases prior to MATLAB R2017b, this assertion occurs if MATLAB is assigning variable size to the Data Store memory. To make sure that the Data store memory is not assigned to use variable size, use the following workaround:
1) Open the model explorer and select the MATLAB function.
2) Change the scope of Data store memory variable to "Input". This will reveal the Variable size option in the dialog.
3) Uncheck the variable size option and apply changes.
4) Change the scope of variable back to Data store memory and apply changes.

More Answers (0)

Products

Release

R2016b

Community Treasure Hunt

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

Start Hunting!