# intrlv

Reorder sequence of symbols

## Syntax

``intrlved = intrlv(data,elements)``

## Description

example

````intrlved = intrlv(data,elements)` rearranges the elements of `data` as specified by `elements`.```

## Examples

collapse all

Use the `intrlv` function to rearrange the elements of a vector to a random permutation vector determined by the `randperm` function. Use the de`intrlv` function to restore the element order of the initial vector by reusing the same random permutation vectorThis illustrates the inverse relationship between the `intrlv` and `deintrlv` functions.

Generate an input signal, `data`, and a permutation vector, `elements`.

`data = 10:10:100`
```data = 1×10 10 20 30 40 50 60 70 80 90 100 ```
`elements = randperm(10) % Permutation vector`
```elements = 1×10 6 3 7 8 5 1 2 4 9 10 ```

Permute the input signal according to the permutation vector by using the `intrlv` function and the restore the input signal order by using the `deintrlv` function.

`a = intrlv(data,elements)`
```a = 1×10 60 30 70 80 50 10 20 40 90 100 ```
`b = deintrlv(a,elements)`
```b = 1×10 10 20 30 40 50 60 70 80 90 100 ```

Use the `intrlv` function to rearrange the elements in the columns of a matrix to a random permutation vector determined by the `randperm` function. Use the de`intrlv` function to restore the element order of the initial matrix by reusing the same random permutation vector. This illustrates the inverse relationship between the `intrlv` and `deintrlv` functions.

Generate an input signal, `data`, and a permutation vector, `elements`.

`data(:,1) = 10:10:100`
```data = 10×1 10 20 30 40 50 60 70 80 90 100 ```
`data(:,2) = 0.1:0.1:1`
```data = 10×2 10.0000 0.1000 20.0000 0.2000 30.0000 0.3000 40.0000 0.4000 50.0000 0.5000 60.0000 0.6000 70.0000 0.7000 80.0000 0.8000 90.0000 0.9000 100.0000 1.0000 ```
`elements = randperm(10) % Permutation vector`
```elements = 1×10 6 3 7 8 5 1 2 4 9 10 ```

Permute the input signal according to the permutation vector by using the `intrlv` function, and then restore the input signal order by using the `deintrlv` function.

`a = intrlv(data,elements)`
```a = 10×2 60.0000 0.6000 30.0000 0.3000 70.0000 0.7000 80.0000 0.8000 50.0000 0.5000 10.0000 0.1000 20.0000 0.2000 40.0000 0.4000 90.0000 0.9000 100.0000 1.0000 ```
`b = deintrlv(a,elements)`
```b = 10×2 10.0000 0.1000 20.0000 0.2000 30.0000 0.3000 40.0000 0.4000 50.0000 0.5000 60.0000 0.6000 70.0000 0.7000 80.0000 0.8000 90.0000 0.9000 100.0000 1.0000 ```

## Input Arguments

collapse all

Input signal, specified as a vector or matrix. If `data` is a matrix with multiple rows and columns, the function processes the columns independently.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `logical` | `fi`
Complex Number Support: Yes

Permutation vector, specified as an integer vector. The permutation vector specifies the mapping used to permute the input signal, `data`. The permutation vector length must equal the input signal length and contain for each integer k in the range [1 `length`(`data`,1)]. If `data` is a length-N vector or an N-row matrix, `elements` must be a length-N vector and contain each integer in the range [1 `length`(`data`,1)]. The sequence in `elements` is the sequence in which elements from `data` or its columns appear in `intrlved`.

Data Types: `double`

## Output Arguments

collapse all

Interleaved data, returned as a vector or matrix with the same dimension and datatype as the input signal. The output contains elements from the input signal mapped as `intrlved`(k,n) = `data`(`elements`(k),n), for each integer k in the range [1 `length`(`data`,1)].

## Version History

Introduced before R2006a