Select a columns of a Matrix using Selector in Simulink

39 ビュー (過去 30 日間)
Hidd_1
Hidd_1 2023 年 6 月 15 日
コメント済み: Jon 2023 年 6 月 15 日
I am having the following simulink model, which contain a Matrix A [3×6] of doubles, and I would like have a selector that selectes the columns of the matrix. (For instance I have a constant which has a value of 2, and then I can select A(:,2))
I have tried with the selector in Simulink, but I coudn't fix it!
I appreciate any help, and Thanks in advanvced!

採用された回答

Jon
Jon 2023 年 6 月 15 日
編集済み: Jon 2023 年 6 月 15 日
I think this is what you are trying to do, in the example below I select the first and the third column from the 3x6 matrix :
  2 件のコメント
Hidd_1
Hidd_1 2023 年 6 月 15 日
It worked, thanks! However, do you have a better idea on how I can incorporate the matrix A [3×6] in a way that, when I assign a value of 2 to a certain constant, I can retrieve the vector A(:,2)?
Jon
Jon 2023 年 6 月 15 日
If I understand what you are asking, if you put a value of 2 into the constant block that connects to the Idx2 port of the selector you will select just column 2, that is A(:,2). Is this what you are asking?
Note the input to the Idx2 port could also be wired to a variable that changes dynamically as your simulation progresses

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by