Delete Rows With empty elements
1 回表示 (過去 30 日間)
古いコメントを表示
Suppose I have a set of data (a 2x9 matrix):
data2 =
[ 1] [0.0095] [5670000] [936] 'Normal' [0] [0] [0] [ NaN]
[ 2] [0.0095] [5670000] [936] 'Normal' [0] [0] [0] [ NaN]
[ 3] [0.0095] [5670000] [936] 'Normal' [0] [0] [0] [ NaN]
[ 4] [0.0095] [5670000] [936] 'Normal' [0] [0] [0] 'some text'
[ 5] [0.0095] [5670000] [936] 'Normal' [0] [0] [0] 'some text'
I want to be able to detect the NaN's and delete the first three columns.
Typically this is done through
data1(find(sum(isnan(data2),2)==0),:)
but isnan is for input arguements of type 'cell'. What else can I try?
2 件のコメント
採用された回答
Azzi Abdelmalek
2013 年 8 月 19 日
data1(any(cellfun(@(x) any(isnan(x)),data1),2),:)=[]
3 件のコメント
Azzi Abdelmalek
2013 年 8 月 19 日
編集済み: Azzi Abdelmalek
2013 年 8 月 19 日
Why have you changed data1? this has nothing to do with your question
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Numeric Types についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!