slvnvmergeharness

Combine test data from harness models

Description

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.

Examples

Log Signals and Merge Test Harnesses

% Log the input signals to the three Model blocks in the sldemo_mdlref_basic example model
% that each reference the same model:
open_system('sldemo_mdlref_basic');
data1 = slvnvlogsignals('sldemo_mdlref_basic/CounterA');
data2 = slvnvlogsignals('sldemo_mdlref_basic/CounterB');
data3 = slvnvlogsignals('sldemo_mdlref_basic/CounterC');
open_system('sldemo_mdlref_counter');

% Make 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