Select subset of elements (submatrix) from matrix input
DSP System Toolbox / Signal Management / Indexing
DSP System Toolbox / Math Functions / Matrices and Linear Algebra / Matrix Operations
The Submatrix block extracts a contiguous submatrix, y,
from the MbyN input matrix u
.
For more information about selecting the rows and columns to extract, see Range Specification Options.
Port_1
— Input signalInput signal, from which the block extracts the specified submatrix.
This block supports Simulink^{®} virtual buses.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 Boolean
 fixed point
 enumerated
Port_1
— Selected submatrixSubmatrix selected from the input signal. The data type of the output is the same as the input.
This block supports Simulink virtual buses.
Data Types: single
 double
 int8
 int16
 int32
 int64
 uint8
 uint16
 uint32
 uint64
 Boolean
 fixed point
 enumerated
For more information about selecting the subset of elements to form the submatrix, see Range Specification Options.
Row span
— Range of rowsAll rows
(default)  One row
 Range of rows
The range of input rows to be retained in the output.
Row
— First row of outputFirst
(default)  Index
 Offset from last
 Last
 Offset from middle
 Middle
The input row to be used as the first and only row of the output.
To enable this parameter, set Row span to
One row
.
Starting row
— First row of outputFirst
(default)  Index
 Offset from last
 Last
 Offset from middle
 Middle
The input row to be used as the first row of the output.
To enable this parameter, set Row span to
Range of rows
.
Row index
— Index of first row1
(default)  positive integerThe index of the input row to be used as the first and only row of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Row span to
One row
and Row to
Index
.
Starting row index
— Index of first row1
(default)  positive integerThe index of the input row to be used as the first row of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Row span to
Range of rows
and Starting
row to Index
.
Row offset
— Offset of first row1
(default)  positive integerThe offset of the input row to be used as the first and only row of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Row span to
One row
and Row to
Offset from last
or Offset
from middle
.
Starting row offset
— Offset of first row1
(default)  positive integerThe offset of the input row to be used as the first row of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Row span to
Range of rows
and Starting
row to Offset from last
or
Offset from middle
.
Ending row
— Last rowLast
(default)  Index
 Offset from last
 Offset from middle
 Middle
The input row to be used as the last row of the output.
To enable this parameter, set Row span to
Range of rows
and set Starting
row to any value except
Last
.
Ending row index
— Index of last row1
(default)  positive integerThe index of the input row to be used as the last row of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Ending row to
Index
.
Ending row offset
— Offset of last row1
(default)  positive integerThe offset of the input row to be used as the last row of the output.
To enable this parameter, set Ending row to
Offset from middle
or Offset
from last
.
Column span
— Range of input columnsAll columns
(default)  One column
 Range of columns
The range of input columns to be retained in the output.
Column
— First columnFirst
(default)  Index
 Offset from last
 Last
 Offset from middle
 Middle
The input column to be used as the first and only column of the output.
To enable this parameter, set Column span to
One column
.
Starting column
— First columnFirst
(default)  Index
 Offset from last
 Last
 Offset from middle
 Middle
The input column to be used as the first column of the output.
To enable this parameter, set Column span to
Range of columns
.
Starting column index
— Index of first column1
(default)  positive integerThe index of the input column to be used as the first column of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Column span to
Range of columns
and Starting
column to Index
.
Column index
— Index of first column1
(default)  positive integerThe index of the input column to be used as the first and only column of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Column span to
One column
and
Column to
Index
.
Column offset
— Offset of first column1
(default)  positive integerThe offset of the input column to be used as the first and only column of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Column span to
One column
and
Column to Offset from
last
or Offset from
middle
.
Starting column offset
— Offset of first column1
(default)  positive integerThe offset of the input column to be used as the first column of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Column span to
Range of columns
and Starting
column to Offset from last
or
Offset from middle
.
Ending column
— Last columnLast
(default)  Index
 Offset from last
 Offset from middle
 Middle
The input column to be used as the last column of the output.
To enable this parameter, set Column span to
Range of columns
and set
Starting column to any value except
Last
.
Ending column index
— Index of last column1
(default)  positive integerThe index of the input column to be used as the last column of the output, specified as an integer greater than or equal to one.
To enable this parameter, set Ending column to
Index
.
Ending column offset
— Offset of last column1
(default)  positive integerThe offset of the input column to be used as the last column of the output.
To enable this parameter, set Ending column to
Offset from middle
or Offset
from last
.
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

The block treats lengthM unoriented vector input as an
Mby1
matrix. The Row
span parameter provides three options for specifying the range of
rows in u
to be retained in submatrix output
y
:
All rows
Specifies that y
contains all M rows
of u
.
One row
Specifies that y
contains only one row from
u
. Selecting One row
enables the Row parameter to allow selection of the
desired row.
Range of rows
Specifies that y
contains a range of rows from u
.
Selecting Range of rows
enables the
Starting row and Ending row
parameters to allow selection of the desired range of rows.
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.
When you select One row
or Range of
rows
from the Row span parameter, you specify
the desired row or range of rows in the Row parameter, or the
Starting row and Ending row
parameters. Similarly, when you select One column
or
Range of columns
from the Column
span parameter, you specify the desired column or range of columns in
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:
First
For rows, this specifies that the first row of u
should
be used as the first row of y
. When all columns are to be
included, this is equivalent to y(1,:) = u(1,:)
.
For columns, this specifies that the first column of u
should be used as the first column of y
. When all rows
are to be included, this is equivalent to y(:,1) =
u(:,1)
.
Index
For rows, this specifies that the row of u
,
firstrow
, forwardindexed by the Row index
parameter or the Starting row index
parameter, should be used as the first row of y
. When all
columns are to be included, this is equivalent to y(1,:) =
u(firstrow,:)
.
For columns, this specifies that the column of u
,
forwardindexed by the Column index parameter or the
Starting column index parameter,
firstcol
, should be used as the first column of
y
. When all rows are to be included, this is
equivalent to y(:,1) = u(:,firstcol)
.
Offset from last
For rows, this specifies that the row of u
offset from
row M by the Row offset or
Starting row offset parameter,
firstrow
, should be used as the first row of
y
. When all columns are to be included, this is
equivalent to y(1,:) = u(Mfirstrow,:)
.
For columns, this specifies that the column of u
offset
from column N by the Column offset
or Starting column offset parameter,
firstcol
, should be used as the first column of
y
. When all rows are to be included, this is
equivalent to y(:,1) = u(:,Nfirstcol)
.
Last
For rows, this specifies that the last row of u
should
be used as the only row of y
. When all columns are to be
included, this is equivalent to y = u(M,:)
.
For columns, this specifies that the last column of u
should be used as the only column of y
. When all rows are
to be included, this is equivalent to y = u(:,N)
.
Offset from middle
When you select this option, the block selects the first row or column of the output
y
by adding the specified offset to the middle row or
column of the input u
. When the number,
X, of input rows or columns is even, the block
defines the middle as X/2 +1. When the number of input rows or columns is odd, the
block defines the middle as ceil
(X/2).
When all columns are to be included, the following code defines the
starting row: y(1,:) = u(MiddleRow+Offset,:)
, where
Offset
is the value of the Row
offset or Starting row offset parameter.
When all rows are to be included, the following code defines the starting
column: y(1,:) = u(:,MiddleColumn+Offset)
, where
Offset
is the value of the Column offset
or Starting column offset parameter.
Middle
When you select this option, the block uses the middle row or column of the input
u
as the first row or column of the output
y
. When the number, X, of input
rows or columns is even, the block defines the middle as X/2 +1. When the number of input rows or columns is odd, the
block defines the middle as ceil
(X/2).
When all columns are to be included, the following code defines the
starting row: y = u(MiddleRow,:)
. When all rows are to be
included, the following code defines the starting column: y =
u(:,MiddleColumn)
.
The Ending row or Ending column can similarly be specified in five ways:
Index
For rows, this specifies that the row of u
forwardindexed by the Ending row index parameter,
lastrow
, should be used as the last row of
y
. When all columns are to be included, this is
equivalent to y(end,:) = u(lastrow,:)
.
For columns, this specifies that the column of u
forwardindexed by the Ending column index parameter,
lastcol
, should be used as the last column of
y
. When all rows are to be included, this is
equivalent to y(:,end) = u(:,lastcol)
.
Offset from last
For rows, this specifies that the row of u
offset from
row M by the Ending row offset
parameter, lastrow
, should be used as the last row of
y
. When all columns are to be included, this is
equivalent to y(end,:) = u(Mlastrow,:)
.
For columns, this specifies that the column of u
offset
from column N by the Ending column
offset parameter, lastcol
, should be used
as the last column of y
. When all rows are to be
included, this is equivalent to y(:,end) =
u(:,Nlastcol)
.
Last
For rows, this specifies that the last row of u
should
be used as the last row of y
. When all columns are to be
included, this is equivalent to y(end,:) = u(M,:)
.
For columns, this specifies that the last column of u
should be used as the last column of y
. When all rows are
to be included, this is equivalent to y(:,end) =
u(:,N)
.
Offset from middle
When you select this option, the block selects the last row or column of the output
y
by adding the specified offset to the middle row or
column of the input u
. When the number,
X, of input rows or columns is even, the block
defines the middle as X/2 +1. When the number of input rows or columns is odd, the
block defines the middle as ceil
(X/2).
When all columns are to be included, the following code defines the ending
row: y(end,:) = u(MiddleRow+Offset,:)
, where
Offset
is the value of the Ending row
offset parameter. When all rows are to be included, the
following code defines the ending column: y(:,end) =
u(:,MiddleColumn+Offset)
, where Offset
is
the value of the Ending column offset parameter.
Middle
When you select this option, the block uses the middle row or column of the input
u
as the last row or column of the output
y
. When the number, X, of input
rows or columns is even, the block defines the middle as X/2 +1. When the number of input rows or columns is odd, the
block defines the middle as ceil
(X/2).
When all columns are to be included, the following code defines the ending
row: y(end,:) = u(MiddleRow,:)
. When all rows are to be
included, the following code defines the ending column: y(:,end) =
u(:,MiddleColumn)
.
Generated code relies on memcpy
or
memset
functions (string.h
) under certain
conditions.
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.