MATLAB: Set difference between two cell arrays

please help me..

I have two cell arrays
A={ [2] [1×2 double]}
B={[2],[3]}
I want to perform set difference operation such that
C=setdiff(A,B);
and answer should be [1×2 double]
what should I do?

Best Answer

>> A = {2,[2,3]};
>> B = {2,3};
>> [XA,XB] = ndgrid(1:numel(A),1:numel(B));
>> X = arrayfun(@(xA,xB)isequal(A{xA},B{xB}),XA,XB);
>> Z = A(~any(X,2));
>> Z{:}
ans = [2,3]