modifyInheritedParam - Modify inherited parameter values in code generation objective - MATLAB (original) (raw)
Main Content
Modify inherited parameter values in code generation objective
Syntax
Description
modifyInheritedParam([objective](#mw%5Fcbb27c18-4785-462b-8c48-a1f08d5f2c61), [param](#mw%5Ff717afe1-2f25-4911-a719-f38766394997), [value](#mw%5F19565b3f-f2d9-40c3-b5f8-3132b064235f))
changes the value of the specified inherited parameter that the Code Generation Advisor verifies in Check model configuration settings against code generation objectives. Use modifyInheritedParam
to change the value of a parameter in an objective that you created from an existing objective.
Examples
Create a custom objective based on theTraceability
objective.
Create a file sl_customization.m
to contain a callback function that creates the custom objective.
function sl_customization(cm) %SL_CUSTOMIZATION objective customization callback
objCustomizer = cm.ObjectiveCustomizer; index = objCustomizer.addCallbackObjFcn(@addObjectives); objCustomizer.callbackFcn{index}();
end
Create and configure the objective in the addObjectives
function. Set the name of the objective and modify the list of checks, parameters, and values to verify. Then register the objective in the Code Generation Advisor.
function addObjectives
% Create the custom objective obj = rtw.codegenObjectives.Objective('ex_trace', 'Traceability'); setObjectiveName(obj, 'Custom Traceability Example');
% Remove inherited parameters from the objective removeInheritedParam(obj, 'MATLABFcnDesc'); removeInheritedParam(obj, 'MATLABSourceComments');
% Remove the inherited code instrumentation check removeInheritedCheck(obj, 'mathworks.codegen.CodeInstrumentation');
% Modify the inherited parameter 'ConvertIfToSwitch' and set the value to 'on' modifyInheritedParam(obj, 'ConvertIfToSwitch', 'on');
% Exclude the inherited check for the software environment excludeCheck(obj, 'mathworks.codegen.SWEnvironmentSpec');
%Register the objective register(obj);
end
Input Arguments
Code generation objective, specified as artw.codegenObjectives.Objective
object.
Name of inherited parameter to modify, specified as a character vector or string scalar.
Parameter value to verify in the Code Generation Advisor, specified as a character vector or string scalar.
Version History
Introduced in R2009a