MATLAB: Getting intersected index without ruining an order of the original data. addressarrayindexintersectmatrixreference Assuming that, A=[1234 345 675 11 2], and B=[345 2 11 2] Don't know how to get a reference matrix from B to A as like ans=[2 5 4 5] Best Answer Use the ismember function:A=[1234 345 675 11 2];B=[345 2 11 2];[~,C] = ismember(B,A)C = 2 5 4 5 Related SolutionsMATLAB: Insert numbers of a matrix B in matrix A (only in odd indexes). k = i + j;C = zeros(1,k);C(1:2:end) = A;C(2:2:end) = B; MATLAB: Return unique items from two matrix How about this?h = setxor(f',g','rows');h = h';The result is:>> hh = 24.1326 26.1735311.1230 448.4572 2.0453 2.0753 -3.2076 -1.0299 Related QuestionRandom pair data.Exchanging negative values in a matrix with 0Interpolation between intersecting curves
Best Answer