How to programmatically find the port types of the blocks
8 views (last 30 days)
Show older comments
Sohil Shrestha on 27 Dec 2021
Commented: Paul on 28 Dec 2021
According to the documentation , "PortConnectivity" parameter of the block has a field "type" which should either return the type (enable, state ...) or number(if it is a data port).
However testing it on Enabled Delay block from Simulink library, the input ports "type" field is 1 and 2 instead of 1 and "enable". Is this a documentation error, api error or my misunderstanding?
Paul on 28 Dec 2021
Well, it does appear that there are several blocks in the Discrete library that all have BlockType == 'Delay'
As far as I can tell, and I might be wrong, the only way to distinguish how each is configured is to interrogate other parameters of the block, like
to determine which input ports are "active" (I can't think of a better word) and go from there.
More Answers (0)
Find more on Sources 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!