MATLAB: Remove NaN from cell array

remove nan

I want to remove cell with NaN input from a cell array. The cell array itself is a field of a structure and the structue is nested inside another cell array of (16×1).
The name of explained cell array with NaN input in my code is y_fast{i,1}.OutList. I write this command to remove NaN from it:
for i=1:length(y_fast)
y_fast{i,1}.OutList(cellfun(@(x)any(isnan(x)),y_fast{i,1}.OutList)) = [];
it is run without any error but it does not remove the NaN from the cell array.
why?? Could Someone help me??

Best Answer

  • S=[y_fast{:}];