How to see all block names and data types at once for a model?
27 views (last 30 days)
Show older comments
MathWorks Support Team
on 14 Sep 2020
Edited: MathWorks Support Team
on 17 Sep 2020
I would like to see all blocks and data types which are used in a Simulink model.
Accepted Answer
MathWorks Support Team
on 17 Sep 2020
Edited: MathWorks Support Team
on 17 Sep 2020
You can see them all at once through Model Explorer.
Also, you can check it by using command "find_system".
For example,
open_system('vdp')
% Compile the vdp model
vdp([],[],[],'compile');
% Find all blocks in model
allBlocks = find_system('vdp','Type','Block')
% Loop through all blocks
for i = 1:numel(allBlocks)
lh = get_param(allBlocks{i},'PortHandles');
outports = lh.Outport;
% Loop through all output ports
for j = 1:numel(outports)
dataType = get(outports(j),'CompiledPortDataType');
% Display the data type
disp([allBlocks{i} ' output port ' num2str(j) ': ' dataType]);
end
end
% Terminate
vdp([],[],[],'term')
0 Comments
More Answers (0)
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!