Can I list out/hightlight all inputs for a specific output

조회 수: 2 (최근 30일)
Li Nen
Li Nen 2017년 3월 6일
답변: Bo Yuan 2017년 8월 2일
I want to, for a specific output, get all its calculation inputs.If they can be highlighted in Simulink model, that will be perfect.

답변 (1개)

Bo Yuan
Bo Yuan 2017년 8월 2일
You can write your own MATLAB script to trace an output signal to its input using get_param function and the handle of the signal. You can do something like:
% example block name
block = 'model/subsystem';
% get block handle by name
blockHandle = get_param(block,'Handle');
% get all port handles of the block
portHandles = get_param(block,'PortHandles');
% get block inport. May need to index if there are multiple inports
inportHandle = portHandles.Inport;
% get input line handle that goes into the port
lineHandle = get_param(inportHandle,'Line');
This can be done recursively until hitting a termination point that can be specified.
The hilite_system function can be used to highlight blocks and signals by their handles.
Starting R2017a, there is another way to highlight signals from Simulink editor.

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by