In Simulink , How to read bus structure member which is enumeration signal (need to read specific enumerate)

2 ビュー (過去 30 日間)
one of BUS Structure member is enumeration signal (created classdef for this enum datatype).
How to read specific enumeration from bus in simulink .

採用された回答

Nehemiae
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
  1 件のコメント
Vamsi
Vamsi 2023 年 3 月 13 日
Thanks Nehemiae, I have been looking for how to include enumeration as a structure member in Bus editor.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeString についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by