Find positions of elements in rows of one matrix in rows of another matrix (efficiency question)
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello.
Im trying to process 2 big matrices in the following way:
a = perms(1:9);
b = perms(1:9);
c = zeros(size(a));
[~,m] = size(a);
tic;
for i = 1:m
c(bsxfun(@eq, a, b(:,i))) = i;
end
toc
Note that a and b are generated with perms just for example purposes.
Can this code be improved to run faster?
Thanks!
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!