フィルターのクリア

Bus elements with multiple dimensions

1 回表示 (過去 30 日間)
Alborz Sakhaei
Alborz Sakhaei 2021 年 4 月 11 日
回答済み: Pramil 2024 年 5 月 22 日
I have a structure S with three time series fields a, b and a.
S.a = timeseries
S.b = timeseries
S.c = timeseries
I'd like to create a bus object (B) with above bus element. But instead of creating 3 bus elements (a, b and c) I'd like to create one bus element (S) with dimension of 3. I created the bus B like this:
S = Simulink.BusElement;
S.Name = 'S';
S.Dimensions = 3;
B = Simulink.Bus;
B.Elements = S;
How can I assing (sub)bus elements (a, b and c) to S (and B)?

採用された回答

Pramil
Pramil 2024 年 5 月 22 日
Hi Alborz,
To create a Bus Object B that contains a single Bus Element S which itself represents a structure with three timeseries fields “a”, “b” and “c”, you will need to create a nested bus structure. This involves creating Bus Objects for both the outer structure B and the inner structure S, and then defining a, b, and c as elements within a bus that S represents. Here is how you can do it on MATLAB R2020a:
  • Define Bus Objects for “a”, “b”, and “c”.
elemA = Simulink.BusElement;
elemA.Name = 'a';
elemB = Simulink.BusElement;
elemB.Name = 'b';
elemC = Simulink.BusElement;
elemC.Name = 'c';
  • Create a Bus Object for the inner structure “S”.
S = Simulink.Bus;
S.Elements = [elemA elemB elemC];
  • Create the outer Bus Object “B” and add “S” as a datatype.
elemS = Simulink.BusElement;
elemS.Name = 'S';
elemS.Dimensions = 1;
elemS.DataType = 'Bus: S';
B = Simulink.Bus;
B.Elements = elemS;
To know more about Simulink.BusElement and Simulink.Bus you can refer the following links:
Hope it helps.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by