Checking for conditions in Dataset
5 views (last 30 days)
Show older comments
I have a dataset of a few rows and columns. I need to find out top 5 numbers from a particular column and check if the sum of these 5 numbers is greater than 50. Also, I have to check if any of the number in entire column if greater than 5?
0 Comments
Answers (1)
madhan ravi
on 6 Jul 2019
M = sort(matrix(:,specific_column));
top_5 = M(1:5);
top_5_greater_than_50 = sum(top_5) > 50;
There_exist = any(matrix(:,specific_column) > 5)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!