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 example model, in the MATLAB Command Window, type:

openExample('slrealtime/SlrtCreateAndRunRealTimeAppFromSimulinkModelExample', ...
    'supportingFile','slrt_ex_osc_rt.slx')
  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';
    openExample(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. (Optional) Generate the ASAP2 file with required version using the Generate Calibration Files tool and customize the ASAP2 file as needed. For more information about generating and customizing the ASAP2 file, see Generate ASAP2 and CDF Calibration Files.

  6. (Optional) Use updateASAP2 function to pack the ASAP2 file to the application object (.mldatx):

    updateASAP2(app_object,updated_a2l);

  7. Load the real-time application onto the target computer:

    load(tg,model_name);

See Also

|

Related Topics