Main Content

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'))
  1. Create a Target object that represents the target computer and connect Simulink Real-Time Explorer to the target computer:

    tg = slrealtime('TargetPC1');
    connect(tg);
  2. Open the model:

    model_name = 'slrt_ex_osc_rt';
    open_system(model_name);
  3. Set the start and stop time parameters:

    set_param(model_name,'StartTime','0');
    set_param(model_name,'StopTime','10');
  4. Build the model:

    slbuild(model_name);
  5. Load the real-time application onto the target computer:

    load(tg,model_name);

See Also

|

Related Topics