Check if the multiple 1x2 arrays contained within a 4x2 array exist within a larger 10x2 array
1 view (last 30 days)
Show older comments
4x2 array a1 below. 10x2 array b1 below. I want to know if the 4 1x2 arrays [1;5], [5;4], [4;7], and [3;1] all exist in b1, irregardless of the order.
The code below is an example of code that should work.
a1= [1, 5, 4, 3; 3, 4, 7, 1]
b1= [5,4,1,3,7,1,9,5,8,3; 4,7,3,1,5,6,3,9,5,3]
0 Comments
Answers (1)
Dyuman Joshi
on 22 Nov 2023
a1 = [1, 5, 4, 3; 3, 4, 7, 1]
b1 = [5,4,1,3,7,1,9,5,8,3; 4,7,3,1,5,6,3,9,5,3]
[out, idx] = ismember(a1.', b1.', 'rows')
0 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!