Code covered by the BSD License  

Highlights from
Merge sorted arrays

4.0

4.0 | 1 rating Rate this file 8 Downloads (last 30 days) File Size: 8.3 KB File ID: #28930

Merge sorted arrays

by Bruno Luong

 

03 Oct 2010 (Updated 31 Oct 2010)

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

| Watch this File

File Information
Description

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

Acknowledgements
This submission has inspired the following:
ChooseK
MATLAB release MATLAB 7.11 (2010b)
Other requirements Mex installed
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
28 Mar 2011 Tal Darom

it works.
note that the .c files have c++ comments, resulting in errors when compiled with gcc.

file names should be changed to .cpp or use a c style comments.

19 Jan 2012 Jan Simon

@Tal: C++ comments are accepted in the C99 style. Only C89 does not consider them, but this standard is 23 years old now.

Please login to add a comment or rating.
Updates
04 Oct 2010

Optionally return the splitting locations of the inputs

31 Oct 2010

Minor speed improvement

Tag Activity for this File
Tag Applied By Date/Time
sort Bruno Luong 04 Oct 2010 11:41:39
sortrows Bruno Luong 04 Oct 2010 11:41:39
sorted Bruno Luong 04 Oct 2010 11:41:39
merge Bruno Luong 04 Oct 2010 11:41:39

Contact us at files@mathworks.com