Main Content

slvnvextract

Extract atomic subsystem or subchart contents into new model

Description

newModel = slvnvextract(subcomponent) extracts the contents of the Atomic Subsystem block or atomic subchart subcomponent and creates a model. slvnvextract returns the name of the new model in newModel. If the model name already exists,slvnvextract uses the subsystem or subchart name for the model name, appending a numeral to the model name.

Note

If an atomic subchart calls an exported graphical function that is outside the subchart, slvnvextract creates the model, but the new model does not compile.

newModel = slvnvextract(subcomponent,showModel) opens the extracted model if you set showModel to true. The extracted model is loaded only if you set showModel to false.

newModel = slvnvextract(modelmissingslfunctiondef) extracts a stub model for the model modelmissingslfunctiondef which has missing Simulink function definitions for the Simulink® Design Verifier™ to analyze. Returns the name of the new model in newModel. sldvextract uses the input model name with a suffix SldvStub for the extracted model name, appending a numeral to the model name if that model name already exists.

newModel = slvnvextract(modelmissingslfunctiondef, showModel) opens the extracted model if you set showModel to true. Extracted model will be only loaded if showModel is set to false.

Examples

collapse all

This example shows how to extract an atomic subsystem from a model and copy it to a new model using slvnvextract.

Load the sldemo_lct_bus model.

modelName = 'slcoverage_lct_bus';
load_system(modelName);
load slcoverage_lct_data.mat

The slcoverage_lct_bus model has an S-Function. Build the S-Function by using legacy_code.

def = legacy_code('initialize');
def.SFunctionName = 'slcoverage_sfun_counterbus';
def.OutputFcnSpec = ...
    ['void counterbusFcn(COUNTERBUS u1[1], '...
    'int32 u2, COUNTERBUS y1[1], int32 y2[1])'];
def.HeaderFiles   = {'counterbus.h'};
def.SourceFiles   = {'counterbus.c'};
def.Options.supportCoverage = true;
legacy_code('generate_for_sim', def);
### Start Compiling slcoverage_sfun_counterbus
mex -I/tmp/Bdoc24b_2679053_1174205/tp6d6080c1/slcoverage-ex66778043 -c /tmp/Bdoc24b_2679053_1174205/tpf36884fe_0b94_43d0_9825_1bede6db035b/counterbus.c -outdir /tmp/Bdoc24b_2679053_1174205/tp4fd33905_52df_4848_b903_598f77c35e44
Building with 'gcc'.
MEX completed successfully.
mex -I/tmp/Bdoc24b_2679053_1174205/tp6d6080c1/slcoverage-ex66778043 /tmp/Bdoc24b_2679053_1174205/tpf36884fe_0b94_43d0_9825_1bede6db035b/tpde6d8007_8d2f_4ebd_8a10_591034af8c7d.c /tmp/Bdoc24b_2679053_1174205/tp4fd33905_52df_4848_b903_598f77c35e44/counterbus.o -L/mathworks/devel/bat/filer/batfs2561-0/Bdoc24b.2679053/build/runnable/matlab/bin/glnxa64 -lmwsl_sfcn_cov_bridge -output slcoverage_sfun_counterbus
Building with 'gcc'.
MEX completed successfully.
mex -I/tmp/Bdoc24b_2679053_1174205/tp6d6080c1/slcoverage-ex66778043 -c /tmp/Bdoc24b_2679053_1174205/tp6d6080c1/slcoverage-ex66778043/counterbus.c -outdir /tmp/Bdoc24b_2679053_1174205/tp4fd33905_52df_4848_b903_598f77c35e44
Building with 'gcc'.
MEX completed successfully.
mex -I/tmp/Bdoc24b_2679053_1174205/tp6d6080c1/slcoverage-ex66778043 /tmp/Bdoc24b_2679053_1174205/tpf36884fe_0b94_43d0_9825_1bede6db035b/slcoverage_sfun_counterbus.c /tmp/Bdoc24b_2679053_1174205/tpf36884fe_0b94_43d0_9825_1bede6db035b/tpaa66042a_c3f0_4fbe_8c41_1992c05055a1.c /tmp/Bdoc24b_2679053_1174205/tpf36884fe_0b94_43d0_9825_1bede6db035b/tpb93175d9_0b8e_4006_9fcf_be91425a9ef5.c /tmp/Bdoc24b_2679053_1174205/tp4fd33905_52df_4848_b903_598f77c35e44/counterbus.o -L/mathworks/devel/bat/filer/batfs2561-0/Bdoc24b.2679053/build/runnable/matlab/bin/glnxa64 -lmwsl_sfcn_cov_bridge -output slcoverage_sfun_counterbus
Building with 'gcc'.
MEX completed successfully.
### Finish Compiling slcoverage_sfun_counterbus
### Exit

Extract the slCounter subsystem from the model and copy it to a new model.

newModel = slvnvextract([modelName,'/slCounter'],true)
newModel =

    'slCounter'

This example shows how to extract an atomic Stateflow® chart from a model and copy it to a new model using slvnvextract.

Load the slvnvdemo_covfilt model.

modelName = 'slvnvdemo_covfilt';
load_system(modelName);

Extract the Mode Logic atomic subchart from the model and copy it into a new model.

newModel = slvnvextract([modelName,'/Mode Logic'],true)
newModel =

    'ModeLogic'

Input Arguments

collapse all

The full path to the atomic subsystem or atomic subchart whose contents are extracted.

Specify if you want the extracted model to be displayed.

Full path to the missing Simulink function model, specified as a character vector or string scalar.

Output Arguments

collapse all

Reports the name of the new extracted model created by slvnvextract.

Version History

Introduced in R2010b