Counting all the numbers above a certain threshold in a matrix, keeping each event seperate.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Charles Brown-King
am 12 Feb. 2016
Kommentiert: Charles Brown-King
am 12 Feb. 2016
I have a (130,93) matrix and I need to know how many times the numbers in each column goes above a certain value, this value stays the same for each column. Please can someone help me out?
1 Kommentar
Star Strider
am 12 Feb. 2016
‘... this value stays the same for each column.’
Wouldn’t you just need to count one column then?
Akzeptierte Antwort
dpb
am 12 Feb. 2016
I'm not positive re: the comment about value being same for each column, either, but the given the prhasing I'm guessing it's referring to the threshold. If so, solution is simply
s=sum(x>threshold);
If the threshold were by column instead, then
s=sum(bsxfun(@gt,x,threshold));
where threshold is a row vector of length size(x,2)
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!