Main Content

Select Rows or Columns from Matrices

This example shows how to use the Variable Selector block.

Open the Simulink model.

The Variable Selector block returns a matrix with only the selected rows or columns of the input matrix. In this example, the Select parameter of the block is set to Rows and the Elements parameter is set to [1 3]. All the other parameters are set to their default values. Because the input is an identity matrix, the output is:

ans =

     1     0     0
     0     0     1

Run the model to verify this output.

See Also

Blocks