User`s guide

Permute Matrix
5-339
5Permute Matrix
Purpose 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.
% Equivalent MATLAB code
y = [A(P(1),:) ; A(P(2),:) ; A(P(3),:) ; ... ; A(P(end),:)]
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.
% Equivalent MATLAB code
y = [A(:,P(1)) A(:,P(2)) A(:,P(3)) ... A(:,P(end))]
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:
Clip index – Clip the index to the nearest valid value (1 or M for row
permutation, and 1 or N for column permutation), and do not issue an alert.
Example: For a 3-by-7 input matrix, a column index of 9 is clipped to 7, and
a row index of -2 is clipped to 1.
Clip and warn – Display a warning message in the MATLAB command
window, and clip the index as described above.
Generate error – Display an error dialog box and terminate the simulation.