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 subchartsubcomponentand creates a model.slvnvextractreturns the name of the new model innewModel. If the model name already exists,slvnvextractuses 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,slvnvextractcreates the model, but the new model does not compile.

newModel= slvnvextract(subcomponent,showModel)opens the extracted model if you setshowModeltotrue. The extracted model is loaded only if you setshowModeltofalse.

newModel= slvnvextract(modelmissingslfunctiondef)extracts a stub model for the modelmodelmissingslfunctiondefwhich has missing Simulink function definitions for the金宝app®Design Verifier™to analyze. Returns the name of the new model innewModel.sldvextractuses the input model name with a suffixSldvStubfor 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 setshowModeltotrue. Extracted model will be only loaded ifshowModelis set tofalse.

Examples

collapse all

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

Load thesldemo_lct_busmodel.

modelName ='slcoverage_lct_bus'; load_system(modelName); loadslcoverage_lct_data.mat

Theslcoverage_lct_busmodel has an S-Function. Build the S-Function by usinglegacy_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/Bdoc22a_1891349_152006/tp80dc3eee/ex66778043 -c /tmp/Bdoc22a_1891349_152006/tp0a646484_c02c_4112_8cc4_a54cb3c06b9b/counterbus.c -outdir /tmp/Bdoc22a_1891349_152006/tp2a8cf399_7ff4_4aba_9ebb_695f8d0cfe50 Building with 'gcc'. MEX completed successfully. mex -I/tmp/Bdoc22a_1891349_152006/tp80dc3eee/ex66778043 /tmp/Bdoc22a_1891349_152006/tp0a646484_c02c_4112_8cc4_a54cb3c06b9b/tp9355ed2f_7957_4654_8be4_702e73f6edfb.c /tmp/Bdoc22a_1891349_152006/tp2a8cf399_7ff4_4aba_9ebb_695f8d0cfe50/counterbus.o -L/mathworks/devel/bat/Bdoc22a/build/matlab/bin/glnxa64 -lmwsl_sfcn_cov_bridge -output slcoverage_sfun_counterbus Building with 'gcc'. MEX completed successfully. mex -I/tmp/Bdoc22a_1891349_152006/tp80dc3eee/ex66778043 -c /tmp/Bdoc22a_1891349_152006/tp80dc3eee/ex66778043/counterbus.c -outdir /tmp/Bdoc22a_1891349_152006/tp2a8cf399_7ff4_4aba_9ebb_695f8d0cfe50 Building with 'gcc'. MEX completed successfully. mex -I/tmp/Bdoc22a_1891349_152006/tp80dc3eee/ex66778043 /tmp/Bdoc22a_1891349_152006/tp0a646484_c02c_4112_8cc4_a54cb3c06b9b/slcoverage_sfun_counterbus.c /tmp/Bdoc22a_1891349_152006/tp0a646484_c02c_4112_8cc4_a54cb3c06b9b/tpcee52688_0427_4c89_be9c_f27c5e394e37.c /tmp/Bdoc22a_1891349_152006/tp0a646484_c02c_4112_8cc4_a54cb3c06b9b/tp11c777e2_df37_43dc_89cf_de6b55aa8979.c /tmp/Bdoc22a_1891349_152006/tp2a8cf399_7ff4_4aba_9ebb_695f8d0cfe50/counterbus.o -L/mathworks/devel/bat/Bdoc22a/build/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 usingslvnvextract.

Load theslvnvdemo_covfiltmodel.

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 byslvnvextract.

版本嗨story

Introduced in R2010b