MATLAB: Do I get an error about evaluating an expression with the MATLAB built-in data type functions like ‘uint8’ when importing ARXML for an AUTOSAR 4.0 software component

Embedded Coder

Why do I get an error about evaluating an expression with the MATLAB built-in data type functions like 'uint8' when importing ARXML for an AUTOSAR 4.0 software component? For example:
Error using autosar.mm.mm2sl.SLModelBuilder.set_param
Expression 'uint8(1)' for block 'myModel/block' returns a
Simulink.AliasType object that has property values that need to be evaluated. This object should be instantiated in a workspace and
referenced by name in Simulink

Best Answer

Simulink imports AUTOSAR data types from the ARXML according to the rules mentioned here:
If you use an application data type name that matches a Simulink built-in data type (double, single, int8, uint8, int16, uint16, int32, uint32, boolean) the imported Simulink.AliasType now shadows the built-in MATLAB functions that might be used to configure the Simulink model created for the imported AUTOSAR software component. In general, application data type names should abstract away from implementation details such as signedness or size, and typically have physically relevant names like EngSpeed. If you know you want to use a data type that directly maps to a Simulink type (or really any other standard platform type), reference an implementation type/platform type rather than an application type.