MATLAB Answers

How can I create a subsystem which performs the opposite of the Multiport Switch block?

64 views (last 30 days)
I would like to create a subsystem which performs the opposite task of the Multiport Switch block. I would like the subsystem to pass a signal to one of several outputs based on a second input.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
It is possible to create a subsystem which performs the opposite task of the Multiport Switch block using some basic blocks from the Simulink block library. An example is attached which demonstrates one possible way to create this subsystem.

  1 Comment

imane RGUIB
imane RGUIB on 25 Jan 2019
The problem is that these blocks are not supported by HDL Coder!
it would help a lot to make them compatible for HDL code generation.

Sign in to comment.

More Answers (2)

Bharath Venkataraman
Bharath Venkataraman on 28 Jan 2019
What output do you expect for each of these output signals in HDL?
Say you have 10 outputs, your input is 1, and you want to send this to output 10, what do you expect to send out to outputs 1-9?

  0 Comments

Sign in to comment.


Kiran Kintali
Kiran Kintali on 28 Jan 2019
Edited: Kiran Kintali on 28 Jan 2019
function [y1, y2, y3] = fcn(u, sel)
y1 = 0;
y2 = 0;
y3 = 0;
switch sel
case 1
y1 = u + 1;
case 2
y2 = u * 2;
otherwise
y3 = u;
end
Can you provide a piece of MATLAB pseudo-code to describe your problem?
I am sure we can help you make it work in the MATLAB function block and generate HDL code from it.

  0 Comments

Sign in to comment.

Tags

Products

Community Treasure Hunt

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

Start Hunting!