Removing NaNs columns in matrices within cell array

1 回表示 (過去 30 日間)
Christina Geo
Christina Geo 2019 年 5 月 23 日
コメント済み: Christina Geo 2019 年 5 月 23 日
I have a cell array X=1*12 and each cell has a matrix 30*9965. Some columns are all Nans(the others haven't any NaN values) . I want to extract the non Nan columns. For example ,the result should be something like X{1,1}=30*8500, X{1,2}=30*4563,X{1,3}=30*6742 etc.
I am trying this but it returnes only the matrices where there aren't any nan values.How do I have to change the code?
nonancellA = cellfun(@(m) m(~any(isnan(m), 2), :), X, 'UniformOutput', false)

採用された回答

madhan ravi
madhan ravi 2019 年 5 月 23 日
nonancellA = cellfun(@(m) m(:,~any(isnan(m),1)), X, 'UniformOutput', false)
  1 件のコメント
Christina Geo
Christina Geo 2019 年 5 月 23 日
That it works perfect!Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by