Simulink.SimulationData.Signal
Container for signal logging information
Description
The software uses Simulink.SimulationData.Signal
objects to
store signal logging information during simulation.
Simulink.SimulationData.Signal
objects contain information about
the source block for the signal, including the port type and index.
Creation
Simulating a model that has signals marked for logging creates one or more
Simulink.SimulationData.Signal
objects.
Description
creates an empty sigobj
= Simulink.SimulationData.SignalSimulink.SimulationData.Signal
object. Use
this syntax to manually create a Signal
object that contains
external input data to load using Inport or In Bus
Element blocks.
Properties
BlockPath
— Block path of source block for Signal
object
Simulink.SimulationData.BlockPath
object
Block path of source block for Signal
object, specified
as a Simulink.SimulationData.BlockPath
object.
Name
— Name of Signal
object
string | character vector
Name of Signal
object to use for name-based access,
specified as a string or character vector.
PropagatedName
— Propagated name of Signal
object
string | character vector
Propagated name of Signal
object, specified as a string
or character vector.
Signal logging captures the propagated signal name if the logging format
is Dataset
and you:
Mark the signal for signal logging.
Enable Configuration Parameters > Data Import/Export > Signal logging.
Select Show Propagated Signals in the Signal Properties dialog box.
The propagated signal name does not include angle brackets
(<>
).
For more information, see Signal Label Propagation.
PortIndex
— Port index
positive integer
Port index of logged signal, specified as a positive integer.
PortType
— Type of port
'outport'
| 'inport'
Type of port, specified as 'outport'
or
'inport'
.
When you log data using signal logging, the port type is
'outport'
.When you create a
Signal
object to use as input to a model, the port type is'inport'
.
Values
— Logged time and data
timeseries
object | timetable
object | structure of timeseries
or timetable
objects | array of structures of timeseries
or
timetable
objects | array of timeseries
objects | cell array of timetable
objects | ...
Logged time and data, specified as:
A MATLAB®
timeseries
objectA MATLAB
timetable
objectA structure of MATLAB
timeseries
objects (for bus signals)A structure of MATLAB
timetable
objects (for bus signals)An array of structures of MATLAB
timeseries
objects (for array of buses signals)An array of structures of MATLAB
timetable
objects (for array of buses signals)An array of MATLAB
timeseries
objects (for nonbus signals in a For Each subsystem)A cell array of MATLAB
timetable
objects (for nonbus signals in a For Each subsystem)
For an example of how to use the Values
property and
plot logged signal data, see Logging Intervals.
Examples
Create Signal Object
Create a Simulink.SimulationData.Signal
object. Specify the signal name and data values.
Time = 0.1*(0:99)';
sig = Simulink.SimulationData.Signal;
sig.Name = "Sine";
sig.Values = timeseries(sin(Time),Time)
sig = Simulink.SimulationData.Signal Package: Simulink.SimulationData Properties: Name: 'Sine' PropagatedName: '' BlockPath: [1×1 Simulink.SimulationData.BlockPath] PortType: 'inport' PortIndex: 1 Values: [1×1 timeseries] Methods, Superclasses
Access Signal Object
When you simulate a model with signals marked for logging, the software saves signal logging information in one or more Simulink.SimulationData.Signal
objects.
Open the model sldemo_fuelsys
that has several signals marked for logging. Then, simulate the model.
mdl = "sldemo_fuelsys";
open_system(mdl)
sim(mdl);
The logged simulation data is grouped in a Simulink.SimulationData.Dataset
object named sldemo_fuelsys_output
.
sldemo_fuelsys_output
sldemo_fuelsys_output = Simulink.SimulationData.Dataset 'sldemo_fuelsys_output' with 10 elements Name BlockPath ______________ ________________________________________ 1 [1x1 Signal] '' sldemo_fuelsys/EGO Fault Switch 2 [1x1 Signal] air_fuel_ratio sldemo_fuelsys/Engine Gas Dynamics 3 [1x1 Signal] '' sldemo_fuelsys/Engine Speed Fault Switch 4 [1x1 Signal] speed sldemo_fuelsys/Engine_Speed_Selector 5 [1x1 Signal] '' sldemo_fuelsys/MAP Fault Switch 6 [1x1 Signal] map sldemo_fuelsys/MAP_Selector 7 [1x1 Signal] ego sldemo_fuelsys/O2_Voltage_Selector 8 [1x1 Signal] '' ...o_fuelsys/Throttle Angle Fault Switch 9 [1x1 Signal] throttle sldemo_fuelsys/Throttle_Angle_Selector 10 [1x1 Signal] fuel sldemo_fuelsys/To Plant - Use braces { } to access, modify, or add elements using index.
Access the Signal
object named speed
.
get(sldemo_fuelsys_output,"speed")
ans = Simulink.SimulationData.Signal Package: Simulink.SimulationData Properties: Name: 'speed' PropagatedName: '' BlockPath: [1x1 Simulink.SimulationData.BlockPath] PortType: 'outport' PortIndex: 1 Values: [1x1 timeseries]
Version History
Introduced before R2006a
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)