From: Ross Anderson on 12 Apr 2010 16:03 I ran profiler on my code, and ismember is the culprit. In most cases, I simply need an index for a vector: if A = [0 1; 4 5; 6 7]; and B = [4 5]; then [~, index] = ismember(B,A,'rows') yields index = 2, which is all I need (the first return value is always true, no checking needed). But this is slow. Can anyone think of an alternative way of doing this?
From: Matt Fig on 12 Apr 2010 16:17 This should be faster: find(A(:,1)==B(1) & A(:,2)==B(2),1,'last')
|
Pages: 1 Prev: regarding histograms.. Next: button group, radio button using guide |