MATLAB Answers

1

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

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.

Tags

Products

3 Answers

Answer by MathWorks Support Team on 27 Jun 2009
 Accepted Answer

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

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.


Answer by 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.


Answer by Kiran Kintali on 28 Jan 2019
Edited by 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.