Find negative in every n rows
    3 views (last 30 days)
  
       Show older comments
    
    David du Preez
 on 12 May 2017
  
    
    
    
    
    Commented: Andrei Bobrov
      
      
 on 15 May 2017
            I have a 2184 x 14 matrix. In column 1 is the datenum value and in column 14 the values that I want to consider. The other columns contain some other data.
I want to consider the first 24rows if any of the values in column 14 are negative. I want to delete the first 24rows and then repeat this for the following 24rows.
0 Comments
Accepted Answer
  Andrei Bobrov
      
      
 on 12 May 2017
        
      Edited: Andrei Bobrov
      
      
 on 15 May 2017
  
      One way
% A - your data [2184 x 14]
ii = ceil((1:size(A,1))'/24);
jj = accumarray(ii,A(:,14),[],@(x)all(x >= 0)); % EDIT
out = A(jj(ii),:);
2 Comments
See Also
Categories
				Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

