Q:
Say I have a matrix:
x = [
11 22 33
44 55 66
11 11 11
33 99 33
11 77 23]
I want to find a specific row in it, say y = [11 11 11].
A1:
You can use ismember with parameter "rows".
A2:
To allow some tolerance:
% engine;
locrow = @(A,x,tol)find(sum(abs(bsxfun(@minus,A,x)),2) <= tol)
% usage;
tol = 0.01
locrow(A,[11.0001, 11.0001, 10.9999], tol)
4 comments:
I found your post very useful! I was trying to find a way of doing exactly what you described, and used the ismember() function to achieve the desired result.
Thank you for the post.
Thanks for the ismember tip. Worked like a charm.
but much too slow. craplab
Post a Comment