Main Content


Class: coder.codedescriptor.CodeDescriptor
Package: coder.codedescriptor

Return names of the referenced models


refModels = getReferencedModelNames(codeDescObj)


refModels = getReferencedModelNames(codeDescObj) returns a list of referenced models for a coder.codedescriptor.CodeDescriptor object. The list includes only the models that the CodeDescriptor object directly references. For example, if model1 references model2 and model2 references model3, then running getReferencedModelNames from the model1 CodeDescriptor object returns only model2, not model3.

Input Arguments

expand all

coder.codedescriptor.CodeDescriptor object for which you want to retrieve the information about generated code.

Output Arguments

expand all

A list of referenced models.


Get Names of Referenced Models Included In a Model

1. Open model AsynchronousEventsTop.


2. Build model.

### Starting serial model reference code generation build.
Warning: Simulink Coder: The tornado.tlc target will be removed in a future release.
### Successfully updated the model reference code generation target for: AsynchronousEventsRef
### Starting build procedure for: AsynchronousEventsTop
Warning: Simulink Coder: The tornado.tlc target will be removed in a future release.
### Successful completion of code generation for: AsynchronousEventsTop

Build Summary

Code generation targets built:

Model                  Action           Rebuild Reason                           
AsynchronousEventsRef  Code generated.  AsynchronousEventsRef.c does not exist.  

Top model targets built:

Model                  Action           Rebuild Reason                                    
AsynchronousEventsTop  Code generated.  Code generation information file does not exist.  

2 of 2 models built (0 models already up to date)
Build duration: 0h 0m 19.369s

3. Create a coder.codedescriptor.CodeDescriptor object for the model.

codeDescObj = coder.getCodeDescriptor('AsynchronousEventsTop')
codeDescObj = 
  CodeDescriptor with properties:

    ModelName: 'AsynchronousEventsTop'
     BuildDir: '/tmp/Bdoc23b_2361005_2205190/tp25ce26c7/simulinkcoder-ex95496067/AsynchronousEventsTop_tornado_rtw'

4. Get a list of referenced models included in model.

refModels = getReferencedModelNames(codeDescObj);
refModels = 1x1 cell array


Version History

Introduced in R2018a