MATLAB Answers

Delete rows or column with NaN for a cell array

17 views (last 30 days)
Farshid Daryabor
Farshid Daryabor on 17 Feb 2020
Answered: Pruthvi G on 12 Mar 2020
I really thanks in advance any help. How can I delete NaN's of column from the cell attached as example file here.
Thanks

  0 Comments

Sign in to comment.

Accepted Answer

Bhaskar R
Bhaskar R on 17 Feb 2020
nan_loc = cellfun(@(x)any(isnan(x)), P_QC, 'UniformOutput', false);
for ii=1:length(P_QC)
P_QC{ii}(:,nan_loc{ii}) = [];
end

  4 Comments

Show 1 older comment
Farshid Daryabor
Farshid Daryabor on 17 Feb 2020
Dear Bhaskar,
I thinks the following cod is working,
for ii=1:length(P_QC)
lon{ii}(nan_loc{ii}) = [];
end

Sign in to comment.

More Answers (1)

Pruthvi G
Pruthvi G on 12 Mar 2020
Data(cellfun(@(cell) any(isnan(cell(:))),Data))={''};

  0 Comments

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!