Main Content

connectCallback

Add callback that responds to new data

Since R2020b

Description

example

connectCallback(instrument_object,hCallback) adds a callback that responds to new data, which is available from the 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.

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