フィルターのクリア

Assign fields to structure array in Simulink

2 ビュー (過去 30 日間)
VuKhoa
VuKhoa 2020 年 3 月 2 日
コメント済み: stozaki 2020 年 3 月 6 日
I have an Array of 5 structures, say A(1), A(2)...A(5). Each of them have 3 fields which are: A(i).field1, A(i).field2, A(i).field3.
I would like to assign a constant value to each field in all structure using Simulink blocks. I am using for loop to circle amongst A(i). How can I access field1, field2, field3 in each structure?

採用された回答

stozaki
stozaki 2020 年 3 月 3 日
You can use MATLAB Function as following.
I attached example model and .mat included struct data.
  2 件のコメント
VuKhoa
VuKhoa 2020 年 3 月 5 日
Thank you! Is it impossible to create a structure without a .mat file?
stozaki
stozaki 2020 年 3 月 6 日
@VuKhoa,
You need a .mat file.
If you can use the bus signal, you can use a method like the attachment.
The method is to assign structure variables to bus signals.
run myData
run myBus
open_system('BusModel');
sim('BusModel');
Regards,
stozaki

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by