![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1318695/image.png)
In Simulink , How to read bus structure member which is enumeration signal (need to read specific enumerate)
조회 수: 1 (최근 30일)
이전 댓글 표시
채택된 답변
Nehemiae
2023년 3월 9일
Hello,
Enumerated types in Simulink are read using the Enumerated Constant block, where one can give a single enumeration member in the Value, or an array of enumeration members as an array in the Value. This is demonstrated below, where the first two Enumerated Constant blocks have a single value, while the third Enumerated Constant block has the array of all enumerations. The bus will simply pass through this data, and hence one can read the required enumeration from the array using the Selector block and by giving the required index in the enumeration as the Index.
classdef BasicColors < Simulink.IntEnumType
enumeration
Red(0)
Yellow(1)
Green(2)
end
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1318695/image.png)
The documentations on the Enumerated Constant block (https://www.mathworks.com/help/simulink/slref/enumeratedconstant.html), using enumerated data (https://www.mathworks.com/help/simulink/ug/using-enumerated-data-in-simulink-models.html#bruiyp7-1) and on the Selector block (https://www.mathworks.com/help/simulink/slref/selector.html) are helpful in this regard.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!