I have 3 arrays with two columns each. Array 2 contains indices of matches between column1 of array 1 and 3.
Now I only want to keep rows in arrays 1 and 3, which are represented in array 2.
I'm using this code right now:
mask1 = ismember(array2(:,1), array1);
mask2 = ismember(array2(:,2), array3);
mask1 = logical(mask1.*mask2)
array2 = array2(mask1,:);
mask3 = ismember(array1, (array2(:,1)));
array1 = array1(mask3,:);
mask4 = ismember(array3, (array2(:,2)));
array3 = array3(mask4,:);
The problem is, that
has a different length than
even I just switched the arguments position.
Is there anyone who can explain to me why this can happen and how to fix it?