Using Bus in Simulink

3 ビュー (過去 30 日間)
gili Maimon
gili Maimon 2023 年 3 月 26 日
回答済み: Sara Nadeau 2023 年 3 月 27 日
The only thing I want to do is to load into Simulink a timetable or a struct that one of is filed is time, and the rest of the field are the signals.
I want each field to be a signal in Simulink according to the "time" field. The documantation is not clear at all, and I didnt find how to do this simple task.
In summery: I want to load a single timetable or a struct (not to create for each column/field a time serious) with From WorkSpace block, and to connect this block to bus selector in order to see thos signals.
It sound to me like a simple task but I didnt mange to find a document that show how to do it without create to each column/ filed a seprate time serious array.
  1 件のコメント
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 3 月 26 日
Can you share your sample data?

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

回答 (2 件)

Paul
Paul 2023 年 3 月 26 日
Does Load Data using the From Workspace Block include an example that will help?

Sara Nadeau
Sara Nadeau 2023 年 3 月 27 日
When you load external input data for a bus using most loading blocks, the bus produced in the model is nonvirtual. That means that the bus is not simply a group of signals but also a definition of the interface, including hierarchy, names, data types, and any other bus element attributes you define.
In order to load input data for a bus using the From Workspace block, you need to create a Simulink.Bus object that defines the data type for the loading block.
Each element in the bus is an independent element, so you do create the data for each element independently. Then, you create a structure in which the bus elements are arranged with the same hierarchy as the bus object definition, using the names of elements in the bus object as the names for the fields in the structure.
The Load Bus Data section of the doc page linked in the other answer shows an example of how to do this.
Loading input data for a bus can be a bit simpler when you use In Bus Element blocks instead of the From Workspace block. You can load data for a virtual bus, so you do not need to create the Simulink.Bus object. You do still need to create data for each element in the bus independently. Here's an example: Load Input Data for a Bus Using In Bus Element Blocks.

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by