Contents

matintrlv

Reorder symbols by filling matrix by rows and emptying it by columns

Syntax

intrlvd = matintrlv(data,Nrows,Ncols)

Description

intrlvd = matintrlv(data,Nrows,Ncols) rearranges the elements in data by filling a temporary matrix with the elements row by row and then sending the matrix contents, column by column, to the output. Nrows and Ncols are the dimensions of the temporary matrix. If data is a vector, it must have Nrows*Ncols elements. If data is a matrix with multiple rows and columns, data must have Nrows*Ncols rows and the function processes the columns independently.

Examples

The command below rearranges each of two columns of a matrix.

b = matintrlv([1 2 3 4 5 6; 2 4 6 8 10 12]',2,3)
b =

     1     2
     4     8
     2     4
     5    10
     3     6
     6    12

To form the first column of the output, the function creates the temporary 2-by-3 matrix [1 2 3; 4 5 6]. Then the function reads down each column of the temporary matrix to get [1 4 2 5 3 6].

More About

See Also

Was this topic helpful?