MATLAB: Exclude NaN cells from a cell array cell arraysMATLABnan I have a cell array of n number of rows and one column. Each row contains an array. I want to exclude these NaN cells or copy this cell array in a new one with skipping the NaN cells in the original. Best Answer Try this: fine_xx = {rand(10,1);rand(10,1);[];rand(10,1);[];[];rand(10,1)}fine_xx = fine_xx(cellfun(@(x)~isempty(x), fine_xx))That eliminiates the empty [] cells. Related SolutionsMATLAB: How to divide 90*90 size matrix into 3*3 windows i=rand(90);reshape(i,3,3,[]) MATLAB: I would like to replace NaN value (in 1 row and 306 columns ) instead of empty matrices inside a cell array of 6804 elements c = cell(5,1) ;for i = [1 2 4] c{i} = rand(1,3) ;endempties = cellfun('isempty',c);c(empties) = {NaN(1,3)} ; Related QuestionDoes a cell vector contains only NaNReplace NaN’s in a cell array with blanks (not empty char/string)Same matrix but not equal problemFinding values of specific range from table row or columnHow to combine cell arrays into a uniform oneDelete nan values and the corresponding value in another array
Best Answer