Cant use nested bus objects with bus object arrays in simulink

Hello,
I am trying to build a Bus (struct) (<Quiver>) that has an array of a nested bus type (<Arrow>). Later, I want to dissect this array (<arrows>), loop over it and use the members (<point>, <head>) of that bus object.
However, I get the following error:
Selected signal 'arrows.origin.x' in the Bus Selector block 'Demo/Inport' is invalid since it refers to a bus element within an array of sub-buses. The path to the array of sub-buses is 'arrows'. Please select the appropriate array element using a Selector block before using the Bus Selector block to access an element within the bus.
This is very annoying. Programatically this is totally normal, nested stucts. Why can I specify the dimension of that struct array, if it wont compile?
How can I do what I intend to do?
This is what I am doing, basically:

1 件のコメント

里局外
里局外 2024 年 4 月 10 日
You'd better double-click the input and check "output as a non-virtual bus"

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

 採用された回答

Mark McBroom
Mark McBroom 2023 年 2 月 3 日

0 投票

As the error message indicates, configure the bus selector to select the arrows element, which is an array of buses. You can then use a selector block to chose one or more of the elements from the array of buses... and/or you can feed into a For Each Subsystem to operate on each of the elements

3 件のコメント

Timo
Timo 2023 年 2 月 3 日
編集済み: Timo 2023 年 2 月 3 日
Thank you, this helped. The selector part was important ("Vector selector", named selector, for anyone reading this)
Saifsiddique
Saifsiddique 2024 年 2 月 14 日
I'm also stuck with the same problem. Does it mean that you selected for this particualr example Bus:Arrow instead of Bus: Quiver in the Data type?
VIGNESH BALAJI
VIGNESH BALAJI 2024 年 5 月 27 日
編集済み: VIGNESH BALAJI 2024 年 5 月 27 日
@Mark McBroom , @Timo and @Saifsiddique I am facing the same problem. I am unable to understand your statements. Can you please let me know how you solved the problem.

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

その他の回答 (0 件)

カテゴリ

製品

リリース

R2022b

質問済み:

2023 年 2 月 1 日

編集済み:

2024 年 5 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by