MATLAB Answers

Adham
0

Switch block need help

Asked by Adham
on 4 Aug 2014
Latest activity Answered by Adham
on 8 Aug 2014
Could anyone please describe this block for me and especially the control port I didn't understand it even after reading the help.
thx

  2 Comments

Adham - no block was included in your question.
The switch block in simulink : Simulink library browser then HDL Coder then Commonly used blocks then switch

Sign in to comment.

2 Answers

Answer by Christopher Berry on 7 Aug 2014
 Accepted Answer

Adham,
The documentation for this block is a bit confusing. Think of it as an if-else, which may make more sense if you have a computer science background.
Something like this:
if (cond == TRUE)
output = u1 %Input port 1
else
output = u3 %Input port 3
end
Where cond can be any of the following 3 choices:
1. cond = u2 >= Threshold
2. cond = u2 > Threshold
3. cond = u2 ~= 0
So the output of the block will be either input 1 or input 2 depending on the value of input 2, the type of condition selected and the value of threshold selected.
Hope that helps some!

  0 Comments

Sign in to comment.


Answer by Adham
on 8 Aug 2014

Thanks, that was helpful

  0 Comments

Sign in to comment.