Consider only a positive numbers of the first columns.
조회 수: 1 (최근 30일)
이전 댓글 표시
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?
댓글 수: 0
채택된 답변
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
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?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!