How to get index of for each block

2 ビュー (過去 30 日間)
alex george
alex george 2018 年 3 月 15 日
編集済み: alex george 2018 年 3 月 16 日
I'm using a for each subsystem block. How can I get which iteration, aka N, that I am currently processing? I don't see any option anywhere to get this data.
I have an array of busses and im routing them into a for each subsystem block, think like this in ruby:
a = [3, 5, 6]
a.each_with_index { |item, index| puts item + index}
returns 3, 6, 8
the index of the iteration is accessible
The block I'm referring to is here: https://www.mathworks.com/help/simulink/slref/foreachsubsystem.html
  1 件のコメント
Birdman
Birdman 2018 年 3 月 16 日
What do you do with for each subsystem exactly? What is your algorithm? Can you share it?

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

回答 (1 件)

Youssef El Seblani
Youssef El Seblani 2018 年 3 月 16 日
編集済み: Youssef El Seblani 2018 年 3 月 16 日
you can utilize this code A{i} for each block. example clc clear A{1,1}=[1,2]; A{1,2}=[1,3]; A{2,1}=[2,3]; A{2,2}=[2,4]; A=[A{1,1},A{1,2};A{2,1},A{2,2}]

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by