MATLAB: Find common elements from cell array and remove it common elements between two cell arrays I have two cell arrays A and B A={1,2,3,4} B={2,3} remove elements from A that is present in cell array B and answer should be {1,4} Best Answer out = A(~ismember([A{:}],[B{:}])); Related SolutionsMATLAB: How to find the elements of a cell array that are not common to another cell array Use the "intersect" function to find the intersection of both arrays. Then, remove from one array the elements that are common to the other array: % Find the intersection [C,ia,ib] = intersect(A,B, 'stable'); % Remove from A the intersection of A and B AminusB = A; AminusB(ia) = []; MATLAB: Logical indexing in cell array Use ismember to search cell arrays:b = {'1' '2' '3' '4' '5' '6'};logicalIndex = ismember(b, '3') % Or...actualIndex = find(ismember(b, '3')) Related QuestionHow to remove common row elements from matrixHow to add extra column that counts the occurance of each character in a cellarrayFind common elements(?) in two arraysIs it possible to allow the UNIQUE function to support mixed data type cell arrays in MATLAB 7.7 (R2008b)Summing the elements of cell arrays for only certain values
Best Answer