From: Conor Gately on
Hi,

Hopefully someone can help me with this.

I have two matrices, A is 8000 x 1 and B is 1000 x 2., all elements are numeric.

A is a column vector of serial dates (six-digit integers) in random order

The first column of B is a range of serial dates that covers all the dates in A. The dates are in sequential order.The second column of B contains integer values associated with each particular date in the first column.

I want to match the randomly ordered dates in A with their corresponding date in B and thereby link them to the associated data value in the second column of B.

Example:

A = [1
4
2
4
4
2
1]

B = [1 22
2 32
3 14
4 17]


RESULT = [1 22
4 17
2 32
4 17
4 17
2 32
1 22]

Any help would be very appreciated

Thanks!

Conor
From: Zach on
[tf,loc] = ismember(A,B(:,1));
RESULT = B(loc,:)