Main Content

Select Startup Parameter Set for Application on Development Computer

After you have added one or more parameter sets to an Application object by using the addParamSet function, you can select one of these parameter sets as the startup parameter set for the real-time application by using the updateStartupParameterSet function. The startup parameter set name is added to the real-time application MLDATX file on the development computer indicated by the Application object. When you load the real-time application on the target computer, Simulink® Real-Time™ loads the startup parameter set.

This example loads a real-time application, imports the parameters into a ParameterSet object, adds the ParameterSet object to a real-time application, and selects the parameter set as the startup parameter set for the startup application.

% connect to target computer; open model; build app;
tg = slrealtime;
modelSTF = getSTFName(tg);
model = 'slrt_ex_osc_outport';
openExample(model);
set_param(model,"SystemTargetFile",modelSTF);
slbuild(model);

% load app; save param set;
load(tg,model);
paramSetName = 'outportTypes';
saveParamSet(tg,paramSetName);

% import param set on development computer;
myParamSet = importParamSet(tg,paramSetName);

% create app object; add param set to app object;
app_obj =  slrealtime.Application(model);
addParamSet(app_obj,myParamSet);

% select startup param set in app object; 
% . . . and set this info in MLDATX file on development computer
updateStartupParameterSet(app_object,myParamSet);

Note

The startupParameterSet value is one of the Options for an Application object. By default, this value is unset. To clear the value, use the process shown in Get and Set Application Options.

Note

The default parameter set and startup parameter set are different names for the same parameter set that Simulink Real-Time loads when loading the real-time application. The different names denote different workflows for selecting the default or startup parameter sets and the location where the parameter set is stored.

  • By using the setDefaultParameSet function, you set the default parameter set selection in the real-time application MLDATX file on the target computer.

  • By using the updateStartupParameterSet function, you set the startup parameter set selection in the real-time application MLDATX file on the development computer.

For more information, see Save and Reload Parameters by Using the MATLAB Language.