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] Related SolutionsMATLAB: Extract and realign cells into new cell A = cell(2,3) ;for i = 1:2 for j = 1:3 A{i,j}{1,1} = rand(12,2) ; A{i,j}{2,1} = rand(30,2) ; endendB = [A{:}] ;B1 = mat2cell(cell2mat(reshape(B(1,:),2,3)),[12 12]);B2 = mat2cell(cell2mat(reshape(B(2,:),2,3)),[30 30]); MATLAB: How to make difference between two cell array solution: NSbutnotsetL=NS(~cellfun(@(y) any(cellfun(@(x) isequal(x,y),setL)),NS)) Related QuestionLinopt mixed integer, binary programLinear combination of cell arraysHi, I am getting error on secant problem.I have 2 cellArray which changes double to string. I wanna compare these 2 cellArray whether they are same or not.
Best Answer