Delete rows in a given array based on values in another array
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I have two arrays A (179528104x1) and B (1x9700). Here, in the array A, I need to retain only the rows that contain values present in the array B and delete all other rows.
0 个评论
采纳的回答
Star Strider
2024-4-10
Perhaps this —
A = randi(99, 50, 1);
Abfr = buffer(A,10) % Show Everything In 'A'
B = randi(99, 10, 1)
[ix,v] = ismember(A, B);
C = A(ix)
.
更多回答(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!