MATLAB: Removing cells containing Inf or NaNs

cell arrays

Hi folks. I have a cell array, each cell containing a column vector. Is there any way to check if a cell contains inf or nans and if so deleting them? I.e if cell{3}=[inf;inf;1;2] then i want to remove it.
Thanks.

Best Answer

YourCellArray( cellfun( @(C) any(isnan(C) | isinf(C)), YourCellArray ) ) = [];