フィルターのクリア

Error in code generation using simulink coder

32 ビュー (過去 30 日間)
Luca Bistolfi
Luca Bistolfi 2023 年 11 月 22 日
回答済み: Aiswarya 2023 年 11 月 28 日
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?

回答 (1 件)

Aiswarya
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).

カテゴリ

Help Center および File ExchangeDeployment, Integration, and Supported Hardware についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by