Documentation Center

  • Trial Software
  • Product Updates

Contents

helintrlv

Permute symbols using helical array

Syntax

intrlved = helintrlv(data,col,ngrp,stp)
[intrlved,state] = helintrlv(data,col,ngrp,stp)
[intrlved,state] = helintrlv(data,col,ngrp,stp,init_state)

Description

intrlved = helintrlv(data,col,ngrp,stp) permutes the symbols in data by placing them in an unlimited-row array in helical fashion and then placing rows of the array in the output, intrlved. data must have col*ngrp elements. If data is a matrix with multiple rows and columns, it must have col*ngrp rows, and the function processes the columns independently.

The function uses the array internally for its computations. The array has unlimited rows indexed by 1, 2, 3,..., and col columns. The function partitions col*ngrp symbols from the input into consecutive groups of ngrp symbols. The function places the kth group in the array along column k, starting from row 1+(k-1)*stp. Positions in the array that do not contain input symbols have default values of 0. The function places col*ngrp symbols from the array in the output, intrlved, by reading the first ngrp rows sequentially. Some output symbols are default values of 0 rather than input symbols; similarly, some input symbols are left in the array and do not appear in the output.

[intrlved,state] = helintrlv(data,col,ngrp,stp) returns a structure that holds the final state of the array. state.value stores input symbols that remain in the col columns of the array and do not appear in the output.

[intrlved,state] = helintrlv(data,col,ngrp,stp,init_state) initializes the array with the symbols contained in init_state.value. The structure init_state is typically the state output from a previous call to this same function, and is unrelated to the corresponding deinterleaver. In this syntax, some output symbols are default values of 0, some are input symbols from data, and some are initialization values from init_state.value.

Examples

The example below rearranges the integers from 1 to 24.

% Interleave some symbols. Record final state of array.
[i1,state] = helintrlv([1:12]',3,4,1);
% Interleave more symbols, remembering the symbols that
% were left in the array from the earlier command.
i2 = helintrlv([13:24]',3,4,1,state);

disp('Interleaved data:')
disp([i1,i2]')
disp('Values left in array after first interleaving operation:')
state.value{:}

During the successive calls to helintrlv, it internally creates the three-column arrays

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

and

[13  8 11;
 14 17 12;
 15 18 21;
 16 19 22;
  0 20 23;
  0  0 24]

In the second array shown above, the 8, 11, and 12 are values left in the array from the previous call to the function. Specifying the init_state input in the second call to the function causes it to use those values rather than the default values of 0.

The output from this example is below. (The actual interleaved data is a tall matrix, but it has been transposed into a wide matrix for display purposes.) The interleaved data comes from the top four rows of the three-column arrays shown above. Notice that some of the symbols in the first half of the interleaved data are default values of 0, some of the symbols in the second half of the interleaved data were left in the array from the first call to helintrlv, and some of the input symbols (20, 23, and 24) do not appear in the interleaved data at all.

Interleaved data:
  Columns 1 through 10 

     1     0     0     2     5     0     3     6     9     4
    13     8    11    14    17    12    15    18    21    16

  Columns 11 through 12 

     7    10
    19    22

Values left in array after first interleaving operation:

ans =

     []


ans =

     8


ans =

    11    12

The example on the reference page for heldeintrlv also uses this function.

More About

See Also

Was this topic helpful?