Intersection of two cells arrays of 256 by 256 by 3 matrices
1 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
Stephen Jue
2017-6-22
I do not know of a way to directly find the intersection between two cells, but you can recast your two cells A and B as matrices and use the "intersect" function, like so:
A = [img1(:), img2(:), img3(:)]';
B = [img4(:), img2(:), img6(:)]';
[~, indicesA, indicesB] = intersect(A, B, 'rows');
This flattens each image into a single row of a matrix, then uses "intersect" with the "rows" option to find the intersection of A and B by row. The variables "indicesA" and "indicesB" will contain the corresponding indices of A and B that are part of the intersection.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!