User`s guide

6 Target Object Reference
6-14
Setting the Value of a Target Object Property from
the Host PC
You can change a target object property by using xPC Target methods on the
host PC.
With xPC Target you can use either a function syntax or an object property
syntax. The syntax set(
target_object, property_name, new_property_value)
can be replaced by:
target_object.propety_name = new_property_value.
For example, to change the stop time mode for the target object
tg:
1 In the MATLAB window, type
tg.stoptime = 1000
2 Alternately, you could type
set(tg, ’stoptime’, 1000)
Parameters are also target object properties. For example, to change the
frequency of the signal generator in the model xpcosc:
1 In the MATLAB window, type
tg.p2 = 30
2 Alternately, you could type
set(tg, ’p2’, 30)
When you change a target object property, the new property value is
downloaded to the target PC. The xPC Target kernel then receives the
information and changes the behavior of the target application.
To get a list of the writable properties, type
set(target_object). The build
process assigns the default name of the target object to
tg.