Read a signal value from a real-time application
This example builds a real-time application from model
slrt_ex_testmodel, loads the application on the
target computer, and gets the value of the signal from block
'Signal Generator' port 1.
tg = slrealtime('TargetPC1'); slbuild('slrt_ex_osc'); load(tg,'slrt_ex_osc'); getsignal(tg,'slrt_ex_osc/Signal Generator',1)
ans = 0
blockPath— Hierarchical name of the originating block
block_path values can a character
vector or string.
portIndex— Index of block port that is connected to signal for streaming
For the selected signal, the output port index is visible in the signal hierarchy available in Simulink Real-Time explorer or in the Model Data Editor.
value— Value of signal
The value is the value of the signal in the real-time application. If the signal is a bus, a struct is returned. Correct data type, complexity, and dimensions are returned.