フィルターのクリア

How in Simulink send one signal from an input to one of several outputs according to a given output number?

14 ビュー (過去 30 日間)
Simulink has a "Multi-Port switch" element that can be used to switch one of the inputs to a single output.
It is necessary to solve the inverse problem:
to switch the only input signal to the selected output of 10 possible.
How it is better to implement it?
PS
The option with element "Output Switch" does not work. Error "Invalid connection between message and signal ports"

回答 (1 件)

Raghava S N
Raghava S N 2023 年 6 月 8 日
I believe what you are looking for is analogous to a digital decoder. I do not believe a Simulink block to do this exists, but you can create one using the MATLAB function block.
And this is the code for it:
function [y0, y1, y2, y3, y4, y5, y6, y7, y8, y9] = fcn(select, input)
y0=0;y1=0;y2=0;y3=0;y4=0;y5=0;y6=0;y7=0;y8=0;y9=0;
switch select
case 0
y0 = input;
case 1
y1 = input;
case 2
y2 = input;
case 3
y3 = input;
case 4
y4 = input;
case 5
y5 = input;
case 6
y6 = input;
case 7
y7 = input;
case 8
y8 = input;
case 9
y9 = input;
end
end
  3 件のコメント
Raghava S N
Raghava S N 2023 年 6 月 9 日
It would be easier to debug if you would share your code/Simulink model.
Alex K
Alex K 2023 年 6 月 9 日
Thanks, but the scheme itself has not yet been formed ... I'm thinking about it. That's why I can't send the code.
So far, the decoder circuit is visible, but it is necessary to block the signal on the unselected outputs so as not to spoil the data in the memory elements connected to the unselected outputs.
In this regard, the question is: is there an element / settings in matlab that controllably blocks the output?

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

カテゴリ

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

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by