Restore ordering of symbols by filling matrix by columns and emptying it by rows
deintrlvd = matdeintrlv(data,Nrows,Ncols)
deintrlvd = matdeintrlv(data,Nrows,Ncols) rearranges the elements in data by filling a temporary matrix with the elements column by column and then sending the matrix contents, row by row, to the output. Nrows and Ncols are the dimensions of the temporary matrix. 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 matintrlv function, use the same Nrows and Ncols inputs in both functions. In that case, the two functions are inverses in the sense that applying matintrlv followed by matdeintrlv leaves data unchanged.
The code below illustrates the inverse relationship between matintrlv and matdeintrlv.
Nrows = 2; Ncols = 3; data = [1 2 3 4 5 6; 2 4 6 8 10 12]'; a = matintrlv(data,Nrows,Ncols); % Interleave. b = matdeintrlv(a,Nrows,Ncols) % Deinterleave.
The output below shows that b is the same as data.
b = 1 2 2 4 3 6 4 8 5 10 6 12