clear all load deciles % Use all row-by-row (dim 2) % all(deciles<0,2) % Count the number of days disp('All negative') sum(all(deciles<0,2)) % Use any row-by-row (dim 2) % any(deciles<0,2) % Count the number of days disp('At least 1 negative') sum(any(deciles<0,2)) % If not any, then none disp('None negative') sum(~any(deciles<0,2)) disp('Another way to count those with none negative') sum(all(deciles>=0,2))