Gets data from the real-time application instrument buffer
In normal (non-buffered) data mode, an instrument for a real-time application can be configured with a callback that gets executed each time data is available. The normal data mode operation of an instrument pushes the data to the callback.
In buffered data mode (when the
instrument.BufferedData flag is
enabled), the callback configured for the instrument is not executed when data arrives.
Instead, the real-time application stores the data and an app (for example, an instrument
panel app) can retrieve the data by using the
The call to this function returns the buffered data, then the function deletes the data from
the instrument. The instrument continues to buffer new data until the next call to the
getBufferedData function. The buffered mode operation of an
instrument lets the app pull the data from the instrument.
An example situation for buffered data mode is the case when callbacks cannot be executed through the Python-MATLAB bridge. When you create an instrument from Python code, there is no way for the instrument to execute a callback in Python because the Python-MATLAB API does not support callbacks. The buffered data mode lets you get the data from the instrument by requesting it.
Get Buffered Data for Instrument
Get buffered data for a real-time application instrument by using the
getBufferedData function. The function gets data that is buffered
from the time that you change the real-time application from normal (not buffered) data
mode to buffered data mode by enabling the
flag. This flag only affects the operation of the
mldatxfile = 'slrt_ex_tank.mldatx'; hInst = slrealtime.Instrument(mldatxfile); connectCallback(hInst,@my_callback); addSignal(hInst,'slrt_ex_tank/ControlValue',1); % . . . change from normal (not buffered) data mode % . . . change to buffered data mode Instrument.BufferedData = "true"; % . . . inside the my_callback (an slrealtime.instrument callback), % . . . you can call getBufferedData myData = getBufferedData(hInst);
map_object — Object that returns signal data
map_object returns the buffered data from the
getBufferedData function call.
Introduced in R2022b