Target and Application Objects
The Simulink®
            Real-Time™ software uses a Target object
      to represent a Speedgoat® target computer and an Application object to represent a real-time
      application. To run and control
      real-time applications on the
      target computer, use the object
      functions. 
An understanding of the Target and
        Application object properties and functions
      helps you to control and test your real-time
      application on the
      target computer.
A Target object
      on the MATLAB® development computer represents the interface to a real-time
      application and the RTOS on the
      target computer. To run and control the
      real-time application, use Target
      objects.
When you change a Target object
      property on the development computer, information is exchanged between the
      target computer and the real-time
      application.
To create a Target object
      for the default target computer, in the MATLAB Command Window, type:
tg = slrealtime
A Target object
      has properties and functions specific to that object. The real-time
      application object functions enables you
      to control a real-time application on
      the target computer from the development
      computer. You enter real-time
      application object functions in the
        MATLAB Command Window on the development computer or you can use MATLAB code scripts. To access the help for these functions from the command line, use
      the syntax:
doc slrealtime/function_nameFor example, to get help on the load function, type:
doc slrealtime/loadTo get a list of all the functions for the Target object,
      use the methods function. For example, to get the functions for
        Target object tg, type:
methods(tg)
If you want to control the real-time application from the target computer, use target computer commands (see Control Real-Time Application at Target Computer Command Line).
Control Real-Time Application by Using Objects
You can create a real-time
        application and control it by using
          Target and
          Application objects
- Open a model and build a real-time application. This example uses the - slrt_ex_oscmodel.- openExample('slrealtime/SlrtAddIOBlocksToSimulinkModelExample'); open_system('slrt_ex_osc'); slbuild('slrt_ex_osc'); 
- Create - Targetand- Applicationobjects to represent the target computer and the real-time application.- tg = slrealtime('TargetPC1'); app = slrealtime.Application('slrt_ex_osc'); 
- Load the real-time application on the target computer by using the - Targetobject.- load(tg,'slrt_ex_osc');
- Set the - Targetobject- stoptimeproperty for the real-time application.- setStopTime(tg,inf); 
- Get the - Applicationobject options property values from the real-time application.- app.Options.get("stoptime")- ans = Inf
- Start the real-time application by using the - Targetobject.- start(tg); 
- Stop the real-time application by using the - Targetobject.- stop(tg); 
Use Real-Time Application Object Functions
To run Target object
        and Application functions, use the
          function_name(target_object, argument_list) syntax.
Unlike properties, for which partial but unambiguous names are permitted, you must enter
        function names in full, in lowercase. For example, to start a real-time application on
        target computer tg, in the MATLAB Command Window, type:
tg = slrealtime; start(tg);