MATLAB: The cell with the max number of elements cell array I have 1×8 cell array and I want t get the cell with the max number of elements for example for the following cell array I need the answer to be cell number 7 can I do this with function max? Best Answer >> c = {1 [1,2] [1,3] [1,2,4] [1,2,4,5] [1,6] [1,2,4,5,7] nan}c = [1] [1x2 double] [1x2 double] [1x3 double] [1x4 double] [1x2 double] [1x5 double] [NaN]>> [~,x] = max(cellfun(@numel,c))x = 7 Related SolutionsMATLAB: How to merge a cell 2×60 into 1×60 One possible way:newcellarray = cellfun(@(column) cell2mat(column), num2cell(yourcellarray, 1), 'UniformOutput', false); MATLAB: Combine a cell array of cell arrays to a single cell array NewCellArray = vertcat( ExistingCellArray{:} ); Related QuestionDoes a cell vector contains only NaNHow to transpose a cell arrayFind the last NaN value in cell array and compare it with the next columnHow to remove NAN from a cell inside a cell arrayHow to convert cell to doubleReplacing the NaN with specific values
Best Answer