You can modify code generation parameters for the active configuration set in the Configuration Parameters dialog box or from the MATLAB® command line. Use the command-line approach for creating a script that automates setting parameters for an established model configuration.
Execution efficiency
In this example, you modify the configuration parameters to support the Code
Generation Advisor application objective, Execution
efficiency
.
Step 1. Open a model.
slexAircraftExample
Step 2. Get the active configuration set.
cs = getActiveConfigSet(model);
Step 3. Select the Generic Real-Time (GRT) target.
switchTarget(cs,'grt.tlc',[]);
Step 4. To optimize execution speed, modify parameters.
If your application objective is Execution
efficiency
, use set_param
to modify
these parameters:
set_param(cs,'MatFileLogging','off'); set_param(cs,'SupportNonFinite','off'); set_param(cs,'RTWCompilerOptimization','on'); set_param(cs,'OptimizeBlockIOStorage','on'); set_param(cs,'EnhancedBackFolding','on'); set_param(cs,'ConditionallyExecuteInputs','on') set_param(cs,'DefaultParameterBehavior','Inlined'); set_param(cs,'BooleanDataType','on'); set_param(cs,'BlockReduction','on'); set_param(cs,'ExpressionFolding','on'); set_param(cs,'LocalBlockOutputs','on'); set_param(cs,'EfficientFloat2IntCast','on'); set_param(cs,'BufferReuse','on');
Step 5. Save the model configuration to a file.
Save the model configuration to a file, 'Exec_efficiency_cs.m'
,
and view the parameter settings.
saveAs(cs,'Exec_Efficiency_cs'); dbtype Exec_Efficiency_cs 1:50