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!