This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Restore ordering of symbols in helical pattern


deintrlvd = helscandeintrlv(data,Nrows,Ncols,hstep)


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.


The command below rearranges a vector using a 3-by-4 temporary matrix and diagonals of slope 1.

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

  Columns 1 through 10 

     1    10     7     4     5     2    11     8     9     6

  Columns 11 through 12 

     3    12

Internally, the function creates the 3-by-4 temporary matrix

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

using length-four diagonals. The function then sends the elements, row by row, to the output d.

Introduced before R2006a

Was this topic helpful?