How can I obtain a handle to a block that is currently in context within a Block Loop in a Simulink report file?

2 views (last 30 days)
In a Simulink report file, I have an Evaluate MATLAB Expression component as a child of a Block Loop component. In the Evaluate MATLAB Expression component, I would like to get a handle to the block that is in context when the Block Loop is being executed.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
Information on how to obtain a handle to a block, model, system, or signal that is in context within a Simulink report component is missing from the Simulink Report Generator documentation.
Use the following commands to gain access to names and handles:
%Access to block
blockname = RptgenSL.getReportedBlock;
blockHandle = get_param(blockname,'handle');
%Model
modelname = RptgenSL.getReportedModel;
modelHandle = get_param(modelname,'handle');
%Signal
signalname = RptgenSL.getReportedSignal;
signalHandle = get_param(signalname,'handle');
%System
systemname = RptgenSL.getReportedSystem;
systemHandle = get_param(systemname,'handle');
The attached example report, built using Simulink Report Generator 2.3.1 (R14SP3), illustrates the use of these commands. The example reports on the demo model vdp.mdl.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!