MATLAB: Are there unused (previously imported) elements in the “ARXML” file and how to remove them

apiarxmlautosarAUTOSAR Blocksetshortname

The generated "ARXML" file declares items (such as enumerations) that were previously imported, but are no longer used in the model, project or directory. These appear as a <SHORT-NAME> in the ARXML file.
Why are these declared and how do remove them?

Best Answer

Simulink preserves previously imported elements that were created through "updateAUTOSARProperties" for round-trip purposes as explained in the following documentation page:
These AUTOSAR properties that are generated in the "ARXML" file can be accessed through the "getAUTOSARProperties" API (documentation linked below).
The "delete" method of the "getAUTOSARProperties" object can be used to remove unused elements. For example, to delete an unused Implementation data type:
>> arProps = autosar.api.getAUTOSARProperties(bdroot);
>> IDTs = arProps.find([],'ImplementationDataType','PathType','FullyQualified')
>> arProps.delete(IDTs{17}) % As an example, this would delete the 17th IDTs element