Consider only a positive numbers of the first columns.

조회 수: 1 (최근 30일)
Francesco
Francesco 2014년 3월 1일
댓글: Francesco 2014년 3월 1일
I have this matrix:
A =
-0.0001 -0.0723 0.0007 0.0013 -0.0007 -0.0016 -0.0009 0.0010 -0.0018
-0.0004 -0.0723 0.0008 0.0012 -0.0008 -0.0017 -0.0009 0.0011 -0.0017
-0.0005 -0.0723 0.0007 0.0013 -0.0008 -0.0017 -0.0009 0.0011 -0.0017
0.0002 -0.0723 0.0007 0.0012 -0.0007 -0.0017 -0.0009 0.0010 -0.0018
-0.0003 -0.0723 0.0006 0.0012 -0.0007 -0.0017 -0.0009 0.0011 -0.0017
0.0005 -0.0723 0.0007 0.0013 -0.0007 -0.0017 -0.0009 0.0011 -0.0017
My issue is to by-pass (or not consider) the rows that start with a negative number in the first column. How can I extend this procedure if I work with cell or struct variable? How can I do it?

채택된 답변

Mischa Kim
Mischa Kim 2014년 3월 1일
편집: Mischa Kim 2014년 3월 1일
Use
B = A(find(A(:,1)>0),:)
Concerning your second question: that, of course, depends on how your cell array looks like. In general, you could convert to a numeric array and then use the code above.
  댓글 수: 5
Mischa Kim
Mischa Kim 2014년 3월 1일
Well, as I said, it depends on how your cell array looks like. So for the one you're posting in your comment: do you want to treat the 8 different arrays as independent ones with regards to ignoring rows that start with a negative number in the first column? Or is this supposed to be one large 1000-by-72 matrix?
Francesco
Francesco 2014년 3월 1일
It's not supposed to be one marge 1000 by 72 matrix. But I would like to to the same procedure you said for each one of the 8 (or n) different arrays. As you said I want to: "treat the 8 different arrays as independent ones with regards to ignoring rows that start with a negative number in the first column"

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

추가 답변 (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