Say I have the following:
- Data matrix M (m-by-n);
- Matching row V (1-by-n);
- Matching positions I (1-by-n logical);
I want to filter all rows of M that have the same values as V at the matching positions I. I believe that Matlab indexing if powerful enough to do that without loops. But how?
Current solution: run though all the columns and update the filtered row positions F (m-by-1 logical).
F = true(m,1);
for k = 1:n;
if I(k);
F = F & (M(:,k)==V(k));
end;
end;
M = M(F,:);