Main Content

matintrlv

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

Description

example

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

collapse all

Use the matintrlv function to reorder the elements filling matrix by rows and emptying it by columns.

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].

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

     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 3-by-2 matrix [1 2; 3 4; 5 6]. Then the function reads down each column of the temporary matrix to get [1 3 5 2 4 6].

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

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a