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

조회 수: 1 (최근 30일)
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일
편집: 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 CenterFile Exchange에서 Deployment, 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