Finding the number of values bigger than a certain number in an array?

26 次查看(过去 30 天)
Suppose I have an array of 50 numbers, how would I find the number of elements bigger than say 21 in an array of random numbers? Conversely, for less than as well.

采纳的回答

Tom
Tom 2012-9-26
编辑:Tom 2012-9-26
x=50*rand(7);
a= x > 21;
numel(a(a>0))

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by