MATLAB quick find of a vector in matrix
问题 I have a piece of code that works in the following way. There is a matrix of size n x 2 . Each element is an integer between 1 and some maximum, say m . I want to search for rows in this matrix, that is, given [v1, v2] , output the index of this. Right now, I am using: k = find(ismember(edges, [v1, v2], 'rows')); However, this is the bottleneck in my code because this is in linear time. I would like to implement some hashmap type structure for fast lookup. What would be an easy way to do this