indices of occurence of each row in MATLAB
I have two matrices, A and B . ( B is continuous like 1:n ) I need to find all the occurrences of each individual row of B in A , and store those row indices accordingly in cell array C . See below for an example. A = [3,4,5;1,3,5;1,4,3;4,2,1] B = [1;2;3;4;5] Thus, C = {[2,3,4];[4];[1,2,3];[1,3,4];[1,2]} Note C does not need to be in a cell array for my application. I only suggest it because the row vectors of C are of unequal length. If you can suggest a work-around, this is fine too. I've tried using a loop running ismember for each row of B , but this is too slow when the matrices A and B