Clear Filters
Clear Filters

How to get list of terminated input constant blocks and sub reference models list?

7 views (last 30 days)
Hi,
In model few constant blocks are terminated. I just want to read all terminated constant blocks.
Query1:
I just want to find list of constant blocks which are terminated in a simulink model.
Query2:
Simulink model is top level(big parent) model and it contains multiple reference models and inside sub reference models. I just want to read list of all reference and sub reference models names recursively.
find_mdlrefs function is giving only one lower level sub reference model blocks.
Please help me to improve my knowledge on simulink blocks programatically.

Answers (1)

Kausthub
Kausthub on 11 Oct 2023
Hi Siva babu,
I understand that you have two queries, one regarding the terminated constant blocks and the other related to obtaining the names of all referenced and sub referenced models.
By list of terminated constant blocks I believe you would like a list of all constant blocks that have been reduced during code generation of a Simulink model using the Embedded Coder which happens when these blocks do not contribute to the model or are virtual blocks. You can get a list of blocks that are reduced in two ways:
  • Programmatically: You can determine programmatically which blocks are reduced in a model by querying the ReducedNonVirtualBlockList parameter of the model to obtain a vector of the block handles of the reduced blocks.
ReducedBlockHandlesVector = get_param(ModelName,'ReducedNonVirtualBlockList');
  • Visualize in Simulink: To highlight and view reduced blocks in Simulink model, on the Simulink toolstrip, go to the Debug tab. From the Information Overlays menu, select Reduced Blocks. Reduced blocks will appear highlighted on the canvas.
Regarding the second query to find all the names of referenced and sub referenced models, “find_mdlrefs” would return the entire hierarchy of referenced blocks and models. Refer to below links for more information:
Hope this helps and solves your queries regarding obtaining a list of terminated constant blocks and all reference model names!

Categories

Find more on Model References in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!