Main Content

connectCallback

Add callback that responds to new data from target computer

Since R2020b

Description

connectCallback(instrument_object,hCallback) adds a callback that responds to new data, which is available from the Speedgoat® target computer. The eventData for the callback shares all the new data available from the target computer since the last time the callback was executed. For more information about using the @my_callback function handle, see Listener Callback Syntax. For information about events and callbacks, see the Add Callbacks for Target Computer Events example for the Simulink Real-Time App Generator.

example

Examples

collapse all

Add a callback that responds to new data available from the target computer and stream that data to the real-time instrument object.

mldatxfile = 'slrt_ex_pendulum_100Hz.mldatx';
hInst = slrealtime.Instrument(mldatxfile);
connectCallback(hInst,@my_callback);

Input Arguments

collapse all

To create the instrument object, use the Instrument function.

Example: hInst

The callback responds to new data becoming available for streaming.

Example: @my_callback

Version History

Introduced in R2020b