Clear Filters
Clear Filters

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

5 views (last 30 days)
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!

Answers (1)

Sanchari on 7 Sep 2023
Edited: Sanchari on 7 Sep 2023
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-
  2. Import Custom Data Type Definitions from External Header Files-
  3. Customize Data Type Replacement-
Release Notes


Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!