How to find number of different types of blocks?

조회 수: 3 (최근 30일)
Bibigul Shektybayeva
Bibigul Shektybayeva 2017년 6월 20일
댓글: Bibigul Shektybayeva 2017년 6월 20일
How to find number of different types of blocks in a system? For example, if I have two terminators, three inputs, and one 'And', and one 'Or', I want to get 4 as an answer. My idea, would be to find all blocks and then go through them in a loop, is there an easier way?

채택된 답변

Fangjun Jiang
Fangjun Jiang 2017년 6월 20일
Try this. Note that in your case, "And" and "Or" block are actually the same block type. It is called logical operator block.
f14;
a=find_system('f14','FindAll','on','type','block');
length(unique(get(a,'BlockType')))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Event Functions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by