Karlo
Karlo

Reputation: 1708

How to manually switch between more than 2 signals in Simulink

Consider the block Manual switch in Simulink. It enables you to switch manually between two inputs. If you have, more than two inputs, a natural thing to do is to construct a cascade as shown in this picture.

enter image description here

Is there an alternative in case of many inputs, such as one manual switch with n inputs?

Note that I was wondering whether there was a 'manual' way to do this. An alternative would be to use a multiport switch and set it with an initialisation script.

Upvotes: 2

Views: 10626

Answers (3)

Bogdan F.
Bogdan F.

Reputation: 46

A Manual Variant Source can be used. You can edit mask parameters to specify the number of inputs

Upvotes: 2

ThePrancingPony
ThePrancingPony

Reputation: 351

Adding to the accepted answer, I achieved it using a Multiport Switch and a Rotary Switch.

Upvotes: 1

Jeremy Mangas
Jeremy Mangas

Reputation: 371

One way to approach this would be to use a Multiport Switch. This allows you to switch between several outputs based on the value of the first input (which you can tie to a constant block).

This way, when you start a simulation, you can choose the desired input by changing the value of the constant block in your model.

Mathworks Multiport Switch Help

Upvotes: 1

Related Questions