This procedure uses the model ex_slrt_rt_osc
(open_system(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_rt_osc')))
).
You must have already completed the setup in Prepare Real-Time Application by Using MATLAB Language.
Signal access by signal index will be removed in a future release. Access signals by signal name instead.
The
Simulink®
Real-Time™ software lists referenced model
signals with their full block path. For example, ex_slrt_rt_osc/childmodel/gain
.
To get a list of signals, type:
tg.ShowSignals = 'on'
Target: TargetPC1 Connected = Yes Application = xpcosc . . . Scopes = 1 NumSignals = 7 ShowSignals = on Signals = INDEX VALUE Type BLOCK NAME LABEL 0 0.000000 DOUBLE Gain 1 0.000000 DOUBLE Gain1 2 0.000000 DOUBLE Gain2 3 0.000000 DOUBLE Integrator 4 0.000000 DOUBLE Integrator1 5 0.000000 DOUBLE Signal Generator 6 0.000000 DOUBLE Sum . . .
If your signal has a unique label, its label is displayed in
the Label
column. If the label is not unique, the
command returns an error.
To get the value of a signal, use the getsignal
method.
In the Command Window, type:
getsignal(tg,'Integrator1')
ans = -3.8771