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.

Open the Model

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('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.

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

A = 4;
slbuild('slrt_ex_osc_inlined');
tg = slrealtime;
load(tg,'slrt_ex_osc_inlined');
setparam(tg,'','A',2);

2. Execute that MATLAB file. Type:

change_inlineA

3. To see the new parameter value, type:

getparam(tg,'','A')
ans =

     2

Close the Model

bdclose("all");

Related Topics