Count connections in model

1 Ansicht (letzte 30 Tage)
Florian Brokhausen
Florian Brokhausen am 12 Mai 2020
Beantwortet: Guru Mohanty am 15 Mai 2020
Is there a way to count all connections between blocks in a Simulink model including masked subsystems?
I am currently using the following code which seems to only get me the connections within non-masked subsystems.
lineHandles = find_system(modelName,'FindAll','on','type','line');
lineDim = size(lineHandles);
lines = lineDim(1,1);
count = 0;
for k = 1:lines
dst = get_param(lineHandles(k),'DstBlockHandle');
if any(dst==-1) || ismember(-1, dst)
continue
end
dst_names = get_param(dst,'Name');
if ~iscell(dst_names)
count = count + 1;
end
end
Any help or pointers would be greatly appreciated!

Antworten (1)

Guru Mohanty
Guru Mohanty am 15 Mai 2020
You can count the number of connections under a mask with the help of the following block parameter setting.
lineHandles = find_system(modelName,'LookUnderMasks', 'on','FindAll','on','type','line');
For your reference, you can go through these documentations.

Kategorien

Mehr zu Subsystems finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by