merge (iddata)

Merge data sets into iddata object


dat = merge(dat1,dat2,....,datN)


dat collects the data sets in dat1, ...,datN into one iddata object, with several experiments. The number of experiments in dat will be the sum of the number of experiments in datk. For the merging to be allowed, a number of conditions must be satisfied:

  • All of datk must have the same number of input channels, and the InputNames must be the same.

  • All of datk must have the same number of output channels, and the OutputNames must be the same. If some input or output channel is lacking in one experiment, it can be replaced by a vector of NaNs to conform with these rules.

  • If the ExperimentNames of datk have been specified as something other than the default 'Exp1', 'Exp2', etc., they must all be unique. If default names overlap, they are modified so that dat will have a list of unique ExperimentNames.

The sampling intervals, the number of observations, and the input properties (Period, InterSample) might be different in the different experiments.

You can retrieve the individual experiments by using the command getexp. You can also retrieve them by subreferencing with a fourth index.

dat1 = dat(:,:,:,ExperimentNumber)


dat1 = dat(:,:,:,ExperimentName)

Storing multiple experiments as one iddata object can be very useful for handling experimental data that has been collected on different occasions, or when a data set has been split up to remove "bad" portions of the data. All the toolbox routines accept multiple-experiment data.


Bad portions of data have been detected around sample 500 and between samples 720 to 730. Cut out these bad portions and form a multiple-experiment data set that can be used to estimate models without the bad data destroying the estimate.

dat = merge(dat(1:498),dat(502:719),dat(731:1000))
m = pem(dat)

Use the first two parts to estimate the model and the third one for validation.

m = pem(getexp(dat,[1,2]));

Was this topic helpful?