>> A = 1:10
A =
1 2 3 4 5 6 7 8 9 10
>> B = [1,25,31,41,11,61,7,81,31,11;81,3,71,31,31,6,11,8,61,31;21,81,2,61,5,31,31,31,19,12;91,31,41,4,61,81,61,41,10,9]
B =
1 25 31 41 11 61 7 81 31 11
81 3 71 31 31 6 11 8 61 31
21 81 2 61 5 31 31 31 19 12
91 31 41 4 61 81 61 41 10 9
>> [X,Y] = ismember(A,B);
>> E = A(X)
E =
1 2 3 4 5 6 7 8 9 10
>> [R,C] = ind2sub(size(B),Y(X))
R =
1 3 2 4 3 2 1 2 4 4
C =
1 3 2 4 5 6 7 8 10 9
Best Answer