MATLAB: Index position of the 1 cell arraylogical? Hi, I have the following cell array TEST = [1] [] [] [0] [] I want to get the index position of the 1 not the 0. thanks 🙂 ! Best Answer find( cellfun(@(C) numel(C) == 1 && C == 1, TEST) )In the special case where each entry is only empty or a scalar, thenfind( cellfun(@(C) C == 1, TEST) )If you want to find a 1 anywhere in the cell:find( cellfun(@(C) any(C == 1), TEST) ) Related SolutionsMATLAB: Replacing Matrix Cells with Date Values d={'01/04/2004' '02/04/2004' '03/04/2004' '04/04/2004' '05/04/2004' '06/04/2004' '07/04/2004'}v=num2cell(randi([0 1],4,7))idx=cell2mat(v)==1for k=1:7 v(idx(:,k),k)=d(k)end MATLAB: Removing empty cell in array Probably there is an easier way..Mat=Mat(~cellfun('isempty',Mat));Mat=reshape(Mat,[],4) Related QuestionAny faster/straightforward way to find the location of empty cell in a cell arrayHow to find the minimum length of a cell arraySum of Cell Array [Besides for loop]Find all elements (cells) of a single element (cell) in cell arrayDeleting zeros from cell matrix without resizing or reshaping matrix
Best Answer