Embedded Coder Dictionary adds an underscore to the header file name, how to stop that?

1 回表示 (過去 30 日間)
AJ
AJ 2023 年 7 月 6 日
編集済み: Sanchari 2023 年 9 月 7 日
Hi,
Embedded Coder Dictionary adds an underscore to the header file name of a storage class if certain characters are used.
Unfortunately, that also includes "../", which signifies the parent directory in an include statement.
See picture:
Any idea how to stop that? I tried to add the "../" through a custom token text, but then the output is just uHeader/Modelname.h
In case this doesn't work, I noticed that you can add the "../" if you use the standard "ImportFromFile" storage class. But if you go that route, the $N variable doesn't get parsed. Is there a way to get it parsed with "ImportFromFile"?
I am thankful for any help!
  1 件のコメント
Sanchari
Sanchari 2023 年 9 月 7 日
Hello, Can you provide me with the files so that I can reproduce the problem at my end.

サインインしてコメントする。

回答 (1 件)

Sanchari
Sanchari 2023 年 9 月 7 日
編集済み: Sanchari 2023 年 9 月 7 日
Hello,
I understand that when you are importing a custom header file using include, the “../” parent directory notation is getting converted to “_../” by default in MATLAB.
There are a few possible approaches to work around this problem:
  1. Rename the Storage Class: If possible, consider renaming the storage class to avoid using "../" or any other characters that trigger the addition of an underscore. By choosing a different name, you can ensure that the header file name remains unchanged and the include statement works as expected.
  2. Modify the Include Statement: Instead of using "../" in the include statement, you can modify it to use an absolute or relative path that explicitly specifies the correct location of the header file. Thus, avoiding relying on the parent directory notation and not adding the underscore by default.
  3. Manually Handle the Header File: Another option is to manually handle the header file in your code. Copy the header file to the desired location without using the "../" notation and update the include statement accordingly. This way, you can ensure that the correct header file is included without relying on the behaviour of Embedded Coder Dictionary.
You can further go through the following documentations to know more about customizing datatype and Release Notes for naming conventions followed for header files:
MathWorks Documentation
  1. Embedded Coder Dictionary- https://www.mathworks.com/help/ecoder/ref/embeddedcoderdictionary.html?searchHighlight=Embedded%20Coder%20Dictionary&s_tid=srchtitle_support_results_1_Embedded%20Coder%20Dictionary
  2. Import Custom Data Type Definitions from External Header Files- https://www.mathworks.com/help/ecoder/ug/import-custom-type-definitions-from-external-header-files.html?searchHighlight=embedded%20coder%20import%20from%20file%20header%20name&s_tid=srchtitle_support_results_2_embedded%20coder%20import%20from%20file%20header%20name
  3. Customize Data Type Replacement- https://www.mathworks.com/help/ecoder/ug/customize-data-type-replacement.html
Release Notes
  1. https://www.mathworks.com/help/bugfinder/misra-c2008-rules.html?searchHighlight=header%20file%20naming%20rule&s_tid=srchtitle_support_results_4_header%20file%20naming%20rule

カテゴリ

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

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by