intrlv
Reorder sequence of symbols
Description
Examples
Use the intrlv function to rearrange the elements of a vector to a random permutation vector determined by the randperm function. Use the deintrlv 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 vectorelements = 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 deintrlv 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 vectorelements = 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
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
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced before R2006a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)