how to find out how many columns have more than 50 elements which are greater than 1?

1 次查看(过去 30 天)
I currently have a matrix that's 100*100 size, and I wish to work out how many columns have more than 50 elements which are greater than 1. Is it possible to do it using only rudimentary functions like find(), mod(), length(), numel(), etc?

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019-10-15
编辑:KALYAN ACHARJYA 2019-10-15
I currently have a matrix that's 100*100 size, and I wish to work out how many columns have more than 50 elements which are greater than 1
Lets say matrix 100*100 named as data
idx=data>1;
result=sum(idx);
data2=result>50;
fprintf('The column number is: %d',sum(data2(:)));

更多回答(1 个)

TADA
TADA 2019-10-15
x = rand(100) * 2;
atLeast50 = sum(x > 1, 1) > 50;

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by