How to find the next intersection of two array structures in Matlab.
For example, I have two arrays struct a and b :
a(1)=struct('x',1,'y',1); a(2)=struct('x',3,'y',2); a(3)=struct('x',4,'y',3); a(4)=struct('x',5,'y',4); a(5)=struct('x',1,'y',5); b(1)=struct('x',1,'y',1); b(2)=struct('x',3,'y',5);
I want to find the intersection of a and b as follows:
c = intersect(a,b)
where c should be
c = struct('x',1,'y',1);
But when it seems wrong, when I type intersect(a,b) , since the elements a and b are both structures. How can I deal with this difficulty. Thanks.
source share