MATLAB: Delete Rows With empty elements

delete rows vector

Suppose I have a set of data (a 2×9 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?

Best Answer

data1(any(cellfun(@(x) any(isnan(x)),data1),2),:)=[]