How to call specific numbers from a matrix?

8 views (last 30 days)
I have a matrix that is 100x3, each row of the matrix represents the percentage material in a soil sample, so each row adds up to 100% with the first column being percentage of sand, second column being percentage of silt, and third being the percentage of clay. This is a problem for a geology class.
I need to know what is command to tell me how many rows in the first column are greater than 50? A similar problem, is how do I do the same thing for more than one column say for example I want to know how many row have greater than 30 in the second column and 25 in the third?
Any help is appreciated.

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 13 Oct 2016
a=rand(100,3)
A=sum(a(:,1)>0.5)
B=sum(a(:,2)>0.3 & a(:,3)>0.2)

More Answers (0)

Community Treasure Hunt

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

Start Hunting!