Main Content

Configure Code Generation Objectives Programmatically

This example shows how to configure code generation objectives by writing a MATLAB® script or entering commands at the command line.

  1. Specify a system target file. If you specify an ERT-based target, more objectives are available. For this example, specify ert.tlc. model_name is the name or handle to the model.

    set_param(model_name, 'SystemTargetFile', 'ert.tlc');

  2. Specify your objectives. For example, if your objectives are execution efficiency and traceability, in that priority, enter:

    set_param(model_name, 'ObjectivePriorities',...
    {'Execution efficiency', 'Traceability'});

  3. Execute the Code Generation Advisor, by using either the Code Generation Advisor or in the Configuration Parameters dialog box. For more information, see Configure Model for Code Generation Objectives by Using Code Generation Advisor.

When you specify a GRT-based system target file, you can specify an objective at the command line. If you specify ROM efficiency, RAM efficiency, Traceability, MISRA C:2012 guidelines, Polyspace, or Safety precaution, the build process changes the objective to Unspecified because you have specified a value that is invalid when using a GRT-based target.

Related Topics