question about matrix interleavers??
Mostrar comentarios más antiguos
how to interleave a matrix and deinterleave it?? so it gets back to its original state?
3 comentarios
the cyclist
el 26 de Mayo de 2013
I suggest you give more detail and/or a small example of what you mean. I, for one, don't understand specifically what you mean by "interleave".
mary
el 26 de Mayo de 2013
Image Analyst
el 26 de Mayo de 2013
That's no answer.
Respuesta aceptada
Más respuestas (1)
Image Analyst
el 26 de Mayo de 2013
Not sure what you mean, but here's one way/interpretation:
m1 = magic(6)
m2 = ones(10, 6)
columns = size(m1, 2)
m1Rows = size(m1, 1)
m2Rows = size(m2, 1)
m3 = zeros(m1Rows+m2Rows, columns);
% Interleave. If there's any difference in the number of rows,
% the mismatching rows will be zero.
% You could handle that differently if you want to,
% for example, just append the remaining rows
% of the taller array.
for row = 1 : max([m1Rows, m2Rows])
m3Row = 2 * (row-1)+1;
if row <= m1Rows
m3(m3Row, :) = m1(row, :);
end
if row <= m2Rows
m3(m3Row+1, :) = m2(row, :);
end
end
m3
Categorías
Más información sobre Interleaving en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!