DSP Blockset    
Permute Matrix

Reorder the rows or columns of a matrix.

Library

Math Functions / Matrices and Linear Algebra / Matrix Operations

Description

The Permute Matrix block reorders the rows or columns of M-by-N input matrix A as specified by indexing input P.

When the Permute parameter is set to Rows, the block uses the rows of A to create a new matrix with the same column dimension. Input P is a length-L vector whose elements determine where each row from A should be placed in the L-by-N output matrix.

For row permutation, a length-M 1-D vector input at the A port is treated as a M-by-1 matrix.

When the Permute parameter is set to Columns, the block uses the columns of A to create a new matrix with the same row dimension. Input P is a length-L vector whose elements determine where each column from A should be placed in the M-by-L output matrix.

For column permutation, a length-N 1-D vector input at the A port is treated as a 1-by-N matrix.

When an index value in input P references a nonexistent row or column of matrix A, the block reacts with the behavior specified by the Invalid permutation index parameter. The following options are available:

When length of the permutation vector P is not equal to the number of rows or columns of the input matrix A, you can choose to get an error dialog box and terminate the simulation by checking Error when length of P is not equal to Permute dimension size.

If input A is frame-based, the output is frame-based; otherwise, the output is sample-based.

Example

In the model below, the top Permute Matrix block places the second row of the input matrix in both the first and fifth rows of the output matrix, and places the third row of the input matrix in the three middle rows of the output matrix. The bottom Permute Matrix block places the second column of the input matrix in both the first and fifth columns of the output matrix, and places the third column of the input matrix in the three middle columns of the output matrix.

As shown in the example above, rows and columns of A can appear any number of times in the output, or not at all.

Dialog Box

Permute
Method of constructing the output matrix; by permuting rows or columns of the input.
Index mode
When set to One-based, a value of 1 in the permutation vector P refers to the first row or column of the input matrix A. When set to Zero-based, a value of 0 in P refers to the first row or column of A.
Invalid permutation index
Response to an invalid index value. Tunable, except in the Simulink external mode.
Error when length of P is not equal to Permute dimension size
Option to display an error dialog box and terminate the simulation if the length of the permutation vector P is not equal to the number of rows or columns of the input matrix A.

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

Submatrix
DSP Blockset
Transpose
DSP Blockset
Variable Selector
DSP Blockset
permute
MATLAB

See Reordering Channels in a Frame-Based Multichannel Signal for related information. Also see Matrix Operations for a list of all the blocks in the Matrix Operations library.


  Pad Polynomial Evaluation