Main Content

helscandeintrlv

Restore ordering of symbols in helical pattern

Description

deintrlvd = helscandeintrlv(data,Nrows,Ncols,hstep) rearranges the elements in data by filling a temporary matrix with the elements in a helical fashion and then sending the matrix contents to the output row by row. Nrows and Ncols are the dimensions of the temporary matrix. hstep is the slope of the diagonal, that is, the amount by which the row index increases as the column index increases by one. hstep must be a nonnegative integer less than Nrows.

Helical fashion means that the function places input elements along diagonals of the temporary matrix. The number of elements in each diagonal is exactly Ncols, after the function wraps past the edges of the matrix when necessary. The function traverses diagonals so that the row index and column index both increase. Each diagonal after the first one begins one row below the first element of the previous diagonal.

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.

To use this function as an inverse of the helscanintrlv function, use the same Nrows, Ncols, and hstep inputs in both functions. In that case, the two functions are inverses in the sense that applying helscanintrlv followed by helscandeintrlv leaves data unchanged.

example

Examples

collapse all

Apply helical scan deinterleaving to the vector [1:12], rearranging the vector using a 3-by-4 temporary matrix and diagonals of slope 1.

Internally, the helscandeintrlv function creates the 3-by-4 temporary matrix using length-four diagonals. As represented here.

[1 10  7  4;
 5  2 11  8;
 9  6  3 12]
ans = 3×4

     1    10     7     4
     5     2    11     8
     9     6     3    12

The function then sends the elements, row by row, to the output d.

d = helscandeintrlv(1:12,3,4,1)
d = 1×12

     1    10     7     4     5     2    11     8     9     6     3    12

Extended Capabilities

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

Version History

Introduced before R2006a