Documentation Center

  • Trial Software
  • Product Updates


Combine test data from harness models


status = slvnvmergeharness(name, models, initialization_commands)


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

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

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.

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


Name of the new harness model, to be stored in the default MATLAB® folder


A cell array of strings that represent harness model names


A cell array of strings the same length as models. initialization_commands defines parameter settings for the test cases of each test harness model.

Output Arguments


If the function saves the data and initialization commands in name, slvnvmergeharness returns a status of 1. Otherwise, it returns 0.


Log the input signals to the three Model blocks in the sldemo_mdlref_basic example model that each reference the same model. Make three test harnesses using the logged signals and merge the three test harnesses:

data1 = slvnvlogsignals('sldemo_mdlref_basic/CounterA');
data2 = slvnvlogsignals('sldemo_mdlref_basic/CounterB');
data3 = slvnvlogsignals('sldemo_mdlref_basic/CounterC');
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);
slvnvmergeharness('new_harness_model',{harness1, harness2, harness3});

See Also


Was this topic helpful?