Merge sorted arrays

Given two already sorted arrays, the function combines them in an unique sorted array

You are now following this Submission

Using this function avoids to call Matlab SORT(), which does unnecessary work since the two inputs is already sorted.

Mex implementation for speed.
'rows' option supported

Cite As

Bruno Luong (2026). Merge sorted arrays (https://www.mathworks.com/matlabcentral/fileexchange/28930-merge-sorted-arrays), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired: ChooseK

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.3.0.0

Fix bug of merge rows with empty array

1.2.0.0

Minor speed improvement

1.1.0.0

Optionally return the splitting locations of the inputs

1.0.0.0