MATLAB: How to determine if an array of objects is part of an other array of objects

MATLABobject arrayoop

I have an array containing classdef-objects ( value class ) of the same class, but with different values for the properties.
A = [ objA, objB, objC, objD ];
Now I get another array with objects of the same class
B = [ objX, objY ];
Comparing objects with each other I can do by
isequal( objX, objA );
which returns true. Also objY is equal to objC.
Now like with numeric arrays (I think there it was any or ismember or just through vector operations) I want to do this kind of check:
isequal( A, B );
and it should return true, because all parameters I'm searching for (combined in array B) are present in A!
Using isequal on A and B returns 0 because not all objects are equal and this is the only function I found to compare objects.
Is there a secret function or workaround?
Thanks for your help! 🙂
EDIT:
Here is a MWE:
class 1 (prop arr contains objects of class 2)
classdef arrOfTests
properties
arr
end %properties

methods
function obj = arrOfTests()
obj.arr = test.empty;
obj.arr(1) = test( 'One', 'Test', 1 );
obj.arr(2) = test( 'Two', 2, [1,2] );
obj.arr(3) = test( 'Three', 'Test', [1,2,3] );
end %function test (Constructor)

end %methods

end %classdef

class 2 (element of array in property of class 1)
classdef test
properties
propOne
propTwo
propThree
end %properties
methods
function obj = test(propOne, propTwo, propThree)
obj.propOne = propOne;
obj.propTwo = propTwo;
obj.propThree = propThree;
end %function test (Constructor)
end %methods
end %classdef
example script to create the objects:
obj = arrOfTests();
compObj = test( 'Two', 2, [1,2] );
isequal( compObj, obj.arr ); % ans = 0; not equal
isequal( compObj, obj.arr(2) ); % ans = 1; is equal
%ismember( compObj, obj.arr ); % Error: Undefined operator '==' for input arguments of type 'test'...
%ismember( compObj, obj.arr(2) ); % Error: Undefined operator '==' for input arguments of type 'test'...
%all( ismember( compObj, obj.arr ) ); % Error: Undefined operator '==' for input arguments of type 'test'...

Best Answer

You can do this using this statement
all(cellfun(@(x) any(x), arrayfun(@(x) arrayfun(@(y) isequal(x, y), A), B, 'UniformOutput', 0)'))
This will check whether all the values of B are present in A.