image thumbnail


version (987 Bytes) by Jason Blackaby
Interleave two vectors


Updated 18 Oct 2007

translation missing:

This function simply interleaves two vectors. The vectors can be of different lengths. If one vector is longer, the leftover elements are just appended to the output vector. This can be done in a couple of lines if the vector lengths are known, but this function handles most of the possibilities automatically, and should save a few minutes.

z = interleave([1 2 3 4], [5 6 7 8 9 10])
= 1 5 2 6 3 7 4 8 9 10

Cite As

Jason Blackaby (2022). interleave (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: Interleave Vectors or Matrices

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!