Selectors : Accessing specific signals In MATLAB to access the 3
rd
and 6
th
elements of a vector,
V say, we would use index notation:
V([3 6]) . Selectors are the Simulink equivalent of these indices in MATLAB:
Constant source with "Interpret vector parameters as 1-D" option checked
The selector above has been configured to extract the 3
rd
and the 6
th
element of the input vector.
This has been done by setting: Number of Inputs = 6 and Index Vector = [3 6]. You can also
configure selectors so that the Index Vector is obtained via an external input (select “Index Vector
(port)” in the drop down menu).
Selectors will also work higher dimensional arrays. It is important to note the dimensions of
the quantities you are working with. Untick the box in the Selector Block Parameters “Interpret
vector as 1-D” to change how the constant is interpreted. By setting Display > Signals & Ports >
Signal Dimensions to on, we now see that the constant has been interpreted as a 2-D vector.
Constant source with "Interpret vector parameters as 1-D" option not checked;
Goto / From Blocks : Move signals without connecting wires Another way to move signals around is to use Goto and From blocks. Send a signal to a Goto block,
where it is given a unique tag. Then a From block can be configured to use this same tag and
access the signal. A simple example is given below. These blocks can be used to avoid complex
signals crossing, and even work to get signals out of subsystems.
Compare To… These blocks compare a signal with either zero, a constant or
another signal. The particular operation (greater than, equals to etc)
is selected by a block parameter. The output is a Boolean.
Logic Operator The Logical Operator block carries out the same
operation as a Boolean logic gate. The logic operation
e.g. AND, OR, NOT etc is selected from block parameters.
The first two blocks (above) are AND blocks with different block parameter settings. The first has
default rectangular icon shape, the second has the icon shape set to distinctive. The last two are
XOR with three inputs (rectangular and distinctive shape).