Path: news.mathworks.com!not-for-mail
From: "Mayuri " <mayuris@rri.res.in>
Newsgroups: comp.soft-sys.matlab
Subject: Keeping track of elements in a merged array
Date: Tue, 13 Mar 2012 04:03:21 +0000 (UTC)
Organization: RRI
Lines: 7
Message-ID: <jjmgu9$i3h$1@newscl01ah.mathworks.com>
Reply-To: "Mayuri " <mayuris@rri.res.in>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1331611401 18545 172.30.248.47 (13 Mar 2012 04:03:21 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 13 Mar 2012 04:03:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3376355
Xref: news.mathworks.com comp.soft-sys.matlab:760749

Hello,
   I would like to do the following :-
I have 2 arrays A and B of size (1,n) and (1,m) where m <n . I want to merge the 2 arrays and arrange the elements in ascending order. For this I thought I would use the functions horzcat and sort to do this. My problem starts here.

  I want to know whether each element of the final array came from array A or B initially. In some sense I need to tag the elements of arrays A and B and these should be retained even after merging and sorting. How do I proceed?

- Thanks