Is there a faster or alternative way to use find()?
1 次查看(过去 30 天)
显示 更早的评论
I have two arrays.
size(A,2) = 525
size(B,2) = 4324438.
I'm trying to find the IDX of B that == A(i). I also have to round and take the first IDX just because of the time resolution of the data.
To achieve this I'm currently doing:
IDX =zeros(1,size(A,2));
for i = 1:size(A,2)
idxCueTemp = find(round(B(:),3)==round(A(i),3));
IDX(i) = idxCueTemp(1);
end
This is painfully slow and is taking ~60s to complete.
Is there a better way?
1 个评论
Matt J
2021-10-5
size(A,2) = 525
size(B,2) = 4324438.
Are size(A,1) and size(B,1) irrelevant for some reason?
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!