Filter löschen
Filter löschen

Question about Relative Path Variable definitions

9 Ansichten (letzte 30 Tage)
Kevin Allen
Kevin Allen am 8 Mär. 2024
Kommentiert: Kevin Allen am 22 Mär. 2024
Hi,
Where do I find path variable definitions? Such as TARGET_ROOT shown below:
I want to use a different relative path for a different .ccxml config file.
Best,
Kevin

Antworten (1)

Saurabh
Saurabh am 22 Mär. 2024
Hi Kevin,
I can figure out that you need to set a relative path to the project root for a hardware configuration file.
To address this issue, setting the model's InitFcn callback to execute a configuration script is recommended. Below is an initial version of the code to consider. Modifications may be necessary to ensure it aligns with the project's specific requirements.
cs = getActiveConfigSet(gcs);
% retrieves the active configuration set of the current Simulink model.
ctd = get_param(cs, 'CoderTargetData');
% This line extracts the CoderTargetData property from the active configuration set.
ctd.Runtime.LoadCommandArg = [pwd, '\my_file.ccxml'];
% The .Runtime.LoadCommandArg property of ctd (CoderTargetData) is then set to this full path.
set_param(cs, 'CoderTargetData', ctd);
% Finally, the modified CoderTargetData object (ctd), now containing the updated path to the configuration file, is written back to the active configuration set of the model.
For more information about the functions used you can refer to the following links:
I hope that was helpful.
  1 Kommentar
Kevin Allen
Kevin Allen am 22 Mär. 2024
Hi Saurabh,
Thanks for your reply. Yes, you understand what I am wanting to do using a .ccxml config file located in the project root instead.
I'll give your suggestions a try and report back.
Best,
Kevin

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by