Instrument
R2026bCreate real-time instrument object
Description
An slrealtime.Instrument object streams signal data from a
real-time simulation running on a Speedgoat® target computer to a MATLAB® development computer or to a destination that you select by using the
Instruments property in the Target Object Properties. For more information, see the addForFileLog
function, addForMATLAB
function, and addForSDI
function. The slrealtime.Instrument object provides access to object
functions, object properties, and object events related to the instrument in the real-time
application.
The object provides access to methods and properties that:
Find instrumented signals in the real-time application and add these to the instrument object.
Add or remove signals in the instrument object.
Connect signals in the object to axes or scalar displays.
Add, get data from, or remove callbacks for signals in the object.
For more information, see Add Instruments to Real-Time Application by Using Simulink Editor and Add Instruments to Real-Time Applications by Using MATLAB Language. You also can work with instruments by using the Simulink Real-Time Instrument Viewer.
Creation
creates an empty instrument object for an existing real-time application
instrument_object = slrealtime.Instrument('appName')appName.
Example: Create Instrument Object for Real-Time Application
creates an empty instrument object without an assigned real-time application. instrument_object = slrealtime.Instrument()
Example: Create Instrument Object without Real-Time Application
Properties
Object Functions
addFileLogSignals | Find signals connected to File Log blocks and add these to real-time instrument object |
addInstrumentedSignals | Find instrumented signals and add these to real-time instrument object |
addSignal | Add signal for streaming to be available in callback |
clearScalarAndLineData | Clear data from children of real-time instrument object |
connectCallback | Add callback that responds to new data from target computer |
connectLine | Connect signal for streaming to axes |
connectScalar | Add signal for streaming to scalar display |
connectXYPlot | Connect X and Y signal structures to display on axes |
copy | Copy the array of handle objects from one Instrument object to another |
delete | Delete real-time instrument object |
generateScript | Generate script that creates scalar and axes controls from signals, scalars, and lines in real-time instrument object |
get | Query Instrument object properties |
getBufferedData | Gets data from the real-time application instrument buffer |
getCallbackDataForSignal | Get callback data for a signal in real-time instrument object |
removeCallback | Removed callback from real-time instrument object |
removeSignal | Remove signal from real-time instrument object |
set | Assign Instrument object property values |
validate | Validate signals in instrument object |
Note
Some Instrument object functions (for example, clearScalarAndLineData, connectCallback, connectLine, connectScalar, connectXYPlot, generateScript, getCallbackDataForSignal, and removeCallback) are not intended for use when selecting a signal streaming
destination by using the Instruments property in the Target Object Properties. Use these object functions when developing App Designer instrument
panels.
Examples
Version History
Introduced in R2020b
See Also
slrealtime.instrument.LineStyle | addInstrumentedSignals | addSignal | clearScalarAndLineData | connectCallback | connectLine | connectScalar | connectXYPlot | delete | generateScript | getCallbackDataForSignal | removeCallback | removeSignal | validate | addForFileLog | addForMATLAB | addForSDI | Simulink Real-Time
Instrument Viewer

