Simulink.SimulationData.Signal - Container for signal logging information - MATLAB (original) (raw)

Main Content

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 moreSimulink.SimulationData.Signal objects.

Syntax

Description

`sigobj` = Simulink.SimulationData.Signal creates an empty Simulink.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.

example

Properties

expand all

Name of Signal object to use for name-based access, specified as a string or 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:

The propagated signal name does not include angle brackets (<>).

For more information, see Signal Label Propagation.

Port index of logged signal, specified as a positive integer.

Type of port, specified as 'outport' or'inport'.

Logged time and data, specified as:

For an example of how to use the Values property and plot logged signal data, see Logging Intervals.

Examples

collapse all

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

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 = 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

Access the Signal object named speed.

get(sldemo_fuelsys_output,"speed")

ans = Simulink.SimulationData.Signal Package: Simulink.SimulationData

Properties: Name: 'speed' PropagatedName: '' BlockPath: [1×1 Simulink.SimulationData.BlockPath] PortType: 'outport' PortIndex: 1 Values: [1×1 timeseries]

Methods, Superclasses

Version History

Introduced before R2006a