Mercurial > hg > ishara
view general/arrutils/interleave.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children | 03694e5c8365 |
line wrap: on
line source
function z=interleave(x,y) % interleave - interleave elements of an array x=x(:); y=y(:); nx=length(x); ny=length(y); if nx>ny z(1:2:2*ny-1)=x(1:ny); z(2:2:2*ny)=y; z(2*ny+1:nx+ny)=x(ny+1:end); else z(1:2:2*nx-1)=x; z(2:2:2*nx)=y(1:nx); z(2*nx+1:nx+ny)=y(nx+1:end); end