필터 지우기
필터 지우기

Delete Rows With empty elements

조회 수: 2 (최근 30일)
T
T 2013년 8월 19일
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
Azzi Abdelmalek 2013년 8월 19일
Do you want to delete just 3 rows?
T
T 2013년 8월 19일
Yes.

댓글을 달려면 로그인하십시오.

채택된 답변

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에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by