Error in code generation using simulink coder
15 次查看(过去 30 天)
显示 更早的评论
Hello, I have this software I am working with for a while and I could compile the code without any issues. From today, even the backup version I kept 'safe' for this kind of issues cannot compile anymore.
The error is:
''For model 'XXX, code mapping of 'Storage Class' to Inport 'ABC' refers to a definition in model code dictionary that does not exist. In Code Mapping Editor, select a valid 'Storage Class' for Inport 'ABC'.''
I never set anything like that and now I have 128 errors like this. How can I solve?
0 个评论
回答(1 个)
Aiswarya
2023-11-28
Hi,
I understand that you are getting an error related to the Storage class in the code mappings. This may be due to migration of Model Data Configurations to Code Mappings, which can happen if model is created in an older version. You can check your Inport storage class by using the following code:
>> myCodeMappingObj = coder.mapping.api.get("XXX");
>> myInputStorageClass = getInport(myCodeMappingObj,"ABC","StorageClass")
'getInport' is a function you may use to get the code mapping of a particular Inport block. You can also set the desired Storage Class for your specific Inport ("ABC") by using 'setInport' function. You may refer to the following link to know more about the functions provided by the coder mapping API: https://www.mathworks.com/help/rtw/ref/coder.mapping.api.codemapping.html
Since you are getting other errors related to code mappings as well, you can use the below command to set the storage class of all the model parameters to 'Default':
>> setDataDefault(myCodeMappingObj,'ModelParameters','StorageClass','Default')
Then you can loop through the different model elements and assign a different Storage class if necessary. Refer to the following link to know more about the different storage classes available :https://www.mathworks.com/help/rtw/ug/choose-a-built-in-storage-class-for-controlling-data-representation-in-the-generated-code.html
You can edit these settings in the Code Mappings Editor UI as well (https://www.mathworks.com/help/rtw/ref/codemappingseditorc.html).
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!