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!