MATLAB: How do i remove a row from a cell or table, if the digit in the last column is -1? Fx the last row in the example below should be removed. thank you

removeing cell rows

{4,7,3,5,0 ; 5,5,5,4,-1}

Best Answer

A_cell={4,7,3,5,0 ; 5,5,5,4,-1};
A_num=cell2mat(A_cell);
A_num(A_num(:,end)==-1,:)=[];
A_cell=num2cell(A_num);
This will of course only work if you can convert your array to a double. If you can't, you can use the code below. It might even be faster under some circumstances.
A_cell={4,7,3,5,0 ; 5,5,5,4,-1};
temp=cellfun(@(x) isequal(x,-1),A_cell(:,end),'UniformOutput',false);
A_cell([temp{:}],:)=[];