Main Content

Tune Inlined Parameters by Using MATLAB Language

You can tune inlined parameters through the MATLAB® interface.

Note

Simulink® Real-Time™ does not support parameters of multiword data types.

You must have already built and downloaded the model slrt_ex_osc_inlined. To open this model, in the MATLAB Command Window, type:

open_system(fullfile(matlabroot, 'toolbox', 'slrealtime', ...
'examples', 'slrt_ex_osc_inlined'))

Tune Inlined Parameter

With the real-application slrt_ex_osc_inlined already running, you can tune inlined parameter A by using the setparam function.

Save the following code in a MATLAB file. For example, change_inlineA.

A = 4;
open_system(fullfile(matlabroot, 'toolbox', 'slrealtime', ...
'examples', 'slrt_ex_osc_inlined')); 
slbuild('slrt_ex_osc_inlined');
tg = slrealtime; 
load(tg,'slrt_ex_osc_inlined');
setparam(tg,'','A',2); 

Execute that MATLAB file. Type:

change_inlineA

To see the new parameter value, type:

getparam(tg,'','A')

Related Topics