Eliminate the table inside a cell, if any NaN exists inside that table.

1 回表示 (過去 30 日間)
BN
BN 2020 年 2 月 10 日
回答済み: fred ssemwogerere 2020 年 2 月 10 日
Hey all,
I have a 1 x 1280 cell containing tables. I am sure there are some NaN inside some tables. I want to eliminate the entire table if any NaN value exists in that table (in the column named precip).
For example: If in all tables (1280), 5 tables have even just one NaN value inside their precip column, I want removing them (tables) totally. So in the output (Cnew), I'll have 1275 tables that have no NaN.
I don't want to remove just NaN rows But I want to remove the whole table from the cell if any NaN exists in that table (precip column).
I attached my cell.
Thank you so much in advance.

採用された回答

fred  ssemwogerere
fred ssemwogerere 2020 年 2 月 10 日
Hello, cellfun should do nicely
CL=cellfun(@(x) any(isfinite(x.precip)),NewC2LatLon);
CSelect=NewC2LatLon(CL); % Final cell array with tables having no "NaN" values

その他の回答 (1 件)

Bhaskar R
Bhaskar R 2020 年 2 月 10 日
Cnew = NewC2LatLon(~cellfun(@(x)any(isnan(x.precip)), NewC2LatLon));

カテゴリ

Help Center および File ExchangeTables についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by