MATLAB: How to extact commone elements from different columns of a cell array common entries in column of a cell I want to extract the common entries in different column of a cell array. Any idea how to extract them? mat file is attached Best Answer Use intersect(). See the first example in the help:Intersection of Two VectorsDefine two vectors with values in common.A = [7 1 7 7 4]; B = [7 0 4 4 0];% Find the values common to both A and B.C = intersect(A,B)C = 4 7 Related SolutionsMATLAB: Delete rows from cell array emptycells = cellfun(@isempty, yourcellarray); %find empty cells in the whole cell arrayyourcellarray(any(emptycells(:, [6 9]), 2), :) = []; %remove rows for which any of column 6 or 9 is empty MATLAB: How to find the common values in two arrays You need the intersect command doc intersectin your case [val,pos]=intersect(a,b) % gives common val and its position in 'a' Related QuestionConvert an 18×1 cell array in a 3×6 cell arrayExtract 2 rows each to be stored in column.Accessing cell arrays within a cell array and merging them together end to end or in the same column/rowSelect elements in a cell arrayHow to find the common elements of 2 cell arrays of strings
Best Answer