Main Content


Combine test data from harness models


status = slvnvmergeharness(name, models, initialization_commands) collects the test data and initialization commands from each test harness model and saves them in a handle to the new model.

initialization_commands is a cell array of character vectors or strings that are the same length as models. It defines parameter settings for the test cases of each test harness model.

slvnvmergeharness assumes that name and the rest of the models in models have only one Signal Builder block on the top level. If a model in models does not meet this restriction or its top-level Signal Builder block does not have the same number of signals as the top-level Signal Builder block in name, slvnvmergeharness does not merge that model's test data into name.

Input Arguments

collapse all

If name does not exist, slvnvmergeharness creates it as a copy of the first model in models. slvnvmergeharness then merges data from other models listed in models into this model. If you create name from a previous slvnvmergeharness run, subsequent runs of slvnvmergeharness for name maintain the structure and initialization from the earlier run. If name matches an existing Simulink® model, slvnvmergeharness merges the test data from models into name.

Names of harness models that are inputs to slvnvmergeharness.

Cell array of character vectors or strings that is the same length as models.

Output Arguments

collapse all

slvnvmergeharness returns a status of 1 if the data and initialization commands are saved in name. Otherwise, it returns 0.


Log Signals and Merge Test Harnesses

This example shows how to merge multiple test harnesses.

Open the directory that contains the example files.


Log the input signals to the three Model blocks in the sldemo_mdlref_basic example model.

data1 = slvnvlogsignals('sldemo_mdlref_basic/CounterA');
data2 = slvnvlogsignals('sldemo_mdlref_basic/CounterB');
data3 = slvnvlogsignals('sldemo_mdlref_basic/CounterC');

Create three test harnesses using the logged signals.

harness1FilePath = slvnvmakeharness('sldemo_mdlref_counter', data1);
harness2FilePath = slvnvmakeharness('sldemo_mdlref_counter', data2);
harness3FilePath = slvnvmakeharness('sldemo_mdlref_counter', data3)
[~, harness1] = fileparts(harness1FilePath);
[~, harness2] = fileparts(harness2FilePath);
[~, harness3] = fileparts(harness3FilePath);

Merge the three test harnesses.

slvnvmergeharness('new_harness_model',{harness1, harness2, harness3});
Introduced in R2010b