From: "Mayuri " <>
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$>
Reply-To: "Mayuri " <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1331611401 18545 (13 Mar 2012 04:03:21 GMT)
NNTP-Posting-Date: Tue, 13 Mar 2012 04:03:21 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3376355
Xref: comp.soft-sys.matlab:760749

   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