DSP Blockset    
Submatrix

Select a subset of elements (submatrix) from a matrix input.

Library

Description

The Submatrix block extracts a contiguous submatrix from the M-by-N input matrix u. A length-M 1-D vector input is treated as an M-by-1 matrix. The Row span parameter provides three options for specifying the range of rows in u to be retained in submatrix output y:

The Column span parameter contains a corresponding set of three options for specifying the range of columns in u to be retained in submatrix y: All columns, One column, or Range of columns. The One column option enables the Column parameter, and Range of columns options enable the Starting column and Ending column parameters.

The output has the same frame status as the input.

Range Specification Options

When One row or Range of rows is selected from the Row span parameter, the desired row or range of rows is specified by the Row parameter, or the Starting row and Ending row parameters. Similarly, when One column or Range of columns is selected from the Column span parameter, the desired column or range of columns is specified by the Column parameter, or the Starting column and Ending column parameters.

The Row, Column, Starting row or Starting column can be specified in six ways:

The Ending row or Ending column can similarly be specified in five ways:

Example

To extract the lower-right 3-by-2 submatrix from a 5-by-7 input matrix, enter the following set of parameters:

The figure below shows the operation for a 5-by-7 matrix with random integer elements, randint(5,7,10).

There are often several possible parameter combinations that select the same submatrix from the input. For example, instead of specifying Last for Ending column, you could select the same submatrix by specifying:

Dialog Box

The parameters displayed in the dialog box vary for different menu combinations. Only some of the parameters listed below are visible in the dialog box at any one time.

Row span
The range of input rows to be retained in the output. Options are All rows, One row, or Range of rows.
Row/Starting row
The input row to be used as the first row of the output. Row is enabled when One row is selected from Row span, and Starting row when Range of rows is selected from Row span.
Row index/Starting row index
The index of the input row to be used as the first row of the output. Row index is enabled when Index is selected from Row, and Starting row index when Index is selected from Starting row.
Row offset/Starting row offset
The offset of the input row to be used as the first row of the output. Row offset is enabled when Offset from middle or Offset from last is selected from Row, and Starting row offset is enabled when Offset from middle or Offset from last is selected from Starting row.
Ending row
The input row to be used as the last row of the output. This parameter is enabled when Range of rows is selected from Row span and any option but Last is selected from Starting row.
Ending row index
The index of the input row to be used as the last row of the output. This parameter is enabled when Index is selected from Ending row.
Ending row offset
The offset of the input row to be used as the last row of the output. This parameter is enabled when Offset from middle or Offset from last is selected from Ending row.
Column span
The range of input columns to be retained in the output. Options are All columns, One column, or Range of columns.
Column/Starting column
The input column to be used as the first column of the output. Column is enabled when One column is selected from Column span, and Starting column is enabled when Range of columns is selected from Column span.
Column index/Starting column index
The index of the input column to be used as the first column of the output. Column index is enabled when Index is selected from Column, and Starting column index is enabled when Index is selected from Starting column.
Column offset/Starting column offset
The offset of the input column to be used as the first column of the output. Column offset is enabled when Offset from middle or Offset from last is selected from Column. Starting column offset is enabled when Offset from middle or Offset from last is selected from Starting column.
Ending column
The input column to be used as the last column of the output. This parameter is enabled when Range of columns is selected from Column span and any option but Last is selected from Starting column.
Ending column index
The index of the input column to be used as the last column of the output. This parameter is enabled when Index is selected from Ending column.
Ending column offset
The offset of the input column to be used as the last column of the output. This parameter is enabled when Offset from middle or Offset from last is selected from Ending column.

Supported Data Types

To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.

See Also

Reshape
Simulink
Selector
Simulink
Variable Selector
DSP Blockset
reshape
MATLAB

See Deconstructing Signals for related information. Also see Matrix Operations and Indexing for a list of all the blocks in these libraries.


  Standard Deviation SVD Solver