combine two arrays and sort
Posted
by
Jun
on Stack Overflow
See other posts from Stack Overflow
or by Jun
Published on 2012-09-14T15:04:53Z
Indexed on
2012/09/14
15:38 UTC
Read the original article
Hit count: 465
Given two arrays like the following:
a = array([1,2,4,5,6,8,9])
b = array([3,4,7,10])
I would like the output to be:
c = array([1,2,3,4,5,6,7,8,9,10])
or:
c = array([1,2,3,4,4,5,6,7,8,9,10])
I'm aware that I can do the following:
c = sort(unique(concatenate((a,b)))
I'm just wondering if there is a faster way to do it as the arrays I'm dealing with have millions of elements.
Any idea is welcomed. Thanks
© Stack Overflow or respective owner