![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1406084/image.png)
How in Simulink send one signal from an input to one of several outputs according to a given output number?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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"
0 comentarios
Respuestas (1)
Raghava S N
el 8 de Jun. de 2023
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1406084/image.png)
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 comentarios
Raghava S N
el 9 de Jun. de 2023
It would be easier to debug if you would share your code/Simulink model.
Ver también
Categorías
Más información sobre Event Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!