Main Content

concat

Concatenate Simulink.SimulationData.Dataset object to another Dataset object

Description

dataset1 = concat(dataset1,dataset2) concatenates the elements of the Simulink.SimulationData.Dataset object dataset2 to the Dataset object dataset1.

example

Examples

collapse all

The vdp model logs data for the x1 and x2 signals. You can log additional signals using signal logging. Mark the signal coming from the Mu block for logging. Then, simulate the model.

Simulink.sdi.markSignalForStreaming('vdp/Mu',1,'on')
out = sim("vdp");

By default, all logged data is returned in a single variable in the workspace as a Simulink.SimulationOutput object. Logged output data is grouped in a Dataset object with the default name yout. You can access the logged output data using dot notation.

ds1 = out.yout
ds1 = 
Simulink.SimulationData.Dataset 'yout' with 2 elements

                         Name  BlockPath 
                         ____  _________ 
    1  [1x1 Signal]      x1    vdp/Out1 
    2  [1x1 Signal]      x2    vdp/Out2 

  - Use braces { } to access, modify, or add elements using index.

Signal logging data is grouped in a Dataset object with the default name logsout.

ds2 = out.logsout
ds2 = 
Simulink.SimulationData.Dataset 'logsout' with 1 element

                         Name  BlockPath 
                         ____  _________ 
    1  [1x1 Signal]      ''    vdp/Mu   

  - Use braces { } to access, modify, or add elements using index.

You can use the concat function to combine the signal logging Dataset object and the logged output Dataset object into one concatenated Dataset object.

combinedDataset = concat(ds1,ds2)
combinedDataset = 
Simulink.SimulationData.Dataset 'yout' with 3 elements

                         Name  BlockPath 
                         ____  _________ 
    1  [1x1 Signal]      x1    vdp/Out1 
    2  [1x1 Signal]      x2    vdp/Out2 
    3  [1x1 Signal]      ''    vdp/Mu   

  - Use braces { } to access, modify, or add elements using index.

Input Arguments

collapse all

Dataset object to concatenate to, specified a Simulink.SimulationData.Dataset object.

Dataset object to concatenate, specified as Simulink.SimulationData.Dataset object.

Version History

Introduced in R2015a