Prepare Real-Time Application by Using MATLAB Language
You can configure your real-time
application by using the MATLAB® language, and then build and download it to the
target computer. This example uses
model slrt_ex_osc_rt
. To open the model, in the MATLAB Command Window,
type:
open_system(fullfile(matlabroot, 'toolbox', 'slrealtime', ... 'examples', 'slrt_ex_osc_rt'))
Create a
Target
object that represents the target computer and connect Simulink Real-Time Explorer to the target computer:tg = slrealtime('TargetPC1'); connect(tg);
Open the model:
model_name = 'slrt_ex_osc_rt'; open_system(model_name);
Set the start and stop time parameters:
set_param(model_name,'StartTime','0'); set_param(model_name,'StopTime','10');
Build the model:
slbuild(model_name);
Load the real-time application onto the target computer:
load(tg,model_name);