Read a signal value from a real-time application
Get Signal Value by Using Port Index and Block Names
This example builds a real-time application from model
slrt_ex_osc, loads the application on the target
computer, and gets the value of the signal from block
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
character vector | string
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
scalar | complex | structure
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.
Introduced in R2021a