MATLAB: How to find index of a value in cell array cell arrays I have this Cell Array ‘A’ of size 3 by 7 A = { 3 4 [] [] [] [] [] 2 6 -2 2 -2.1 2 2 -5 -5 25 1 [] [] []} I want to find index of ‘6’ element in 2nd row and 2nd column The answer shall be row = 2 and column = 2 Best Answer isSix = cellfun(@(x)isequal(x,6),A);[row,col] = find(isSix); Related SolutionsMATLAB: Finding row index an element in cell array find(cellfun(@(subc) ismember(7, subc), c)) MATLAB: How to get row index of cell which contains certain matrix Normally, you'd use ismember for this, but ismember is not defined for cell arrays (except cell arrays of strings), so use cellfun instead:rows = find(cellfun(@(m) isequal(m, A), Data(:, 1))); Related QuestionError of All contents of the input cell array must be of the same data type.Find index of cell containing strings from cell arrayDelete rows from cell arrayExtract numbers from cell arrayConvert Cell to Matrix
Best Answer