MATLAB: Do I get a Index exceeds matrix dimensions error when building a model for AUTOSAR

Embedded Coder

I tried to build my model for AUTOSAR with masked subsystems but I received an error that says:
### Generating code into build folder: <modelroot>\Autosar_Model_Template_Upadted_autosar_rtw
### Invoking Target Language Compiler on Autosar_Model_Template_Upadted.rtw
### Using System Target File: <matlabroot>\toolbox\rtw\targets\autosar\autosar\autosar.tlc
### Loading TLC function libraries
### Generating TLC interface API for custom data
### Initial pass through model to cache user defined code
### Caching model source code
### Writing header file Autosar_Model_Template_Upadted.h
### Writing header file Autosar_Model_Template_Upadted_types.h
### Writing header file runUreaDoserOverrideTest_Stop_private.h
### Writing header file runUreaTankHeater1RelayTest_Start_private.h
### Writing source file Autosar_Model_Template_Upadted.c
### Writing header file Autosar_Model_Template_Upadted_private.h
### Writing source file runUreaDoserOverrideTest_Stop.c
### Writing source file runUreaTankHeater1RelayTest_Start.c
### Writing source file Autosar_Model_Template_Upadted_data.c
### TLC code generation complete.
### Build procedure for model: 'Autosar_Model_Template_Upadted' aborted due to an error.
The call to autosar_make_rtw_hook, during the after_tlc hook generated the following error:
Index exceeds matrix dimensions.
The build process will terminate as a result.
Caused by:
Index exceeds matrix dimensions.
How do I fix the error?

Best Answer

When the subsystems in the model are masked, during the build process, the function autosar_make_rtw_hook is unable to access the blocks under the mask.
As a workaround, remove the mask for the subsystems.
Related Question