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?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2013-8-19
data1(any(cellfun(@(x) any(isnan(x)),data1),2),:)=[]
  3 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2013-8-19
编辑:Azzi Abdelmalek 2013-8-19
Why have you changed data1? this has nothing to do with your question
T
T 2013-8-19
Sorry, the original post should have read data2.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numeric Types 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by