MATLAB Answers

How can I do such a "countifs"(excel) process in Matlab?

47 views (last 30 days)
KO
KO on 18 Apr 2021
Answered: Stephan on 18 Apr 2021
How can I do such a "countifs"(excel) process in Matlab?

Answers (1)

Stephan
Stephan on 18 Apr 2021
You do it by logical indexing:
A = randi(10,1,15)
CountIf = numel(A(A>5))
gives:
A =
9 7 4 10 1 5 4 8 8 2 5 5 7 8 8
CountIf =
8

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!