Checking for conditions in Dataset

1 回表示 (過去 30 日間)
Siddharth Jain
Siddharth Jain 2019 年 7 月 6 日
コメント済み: Siddharth Jain 2019 年 7 月 6 日
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?

回答 (1 件)

madhan ravi
madhan ravi 2019 年 7 月 6 日
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)
  1 件のコメント
Siddharth Jain
Siddharth Jain 2019 年 7 月 6 日
As per attached, the dataset named "Getcompo" has the data. I want to perform following operation on 5th column,i.e, weight. Also, if the sum of top 5 weights is greater than 50 or if there is a weight greater than 5, then the output of the operation should be stored as 1 else it should be zero. I need to perform this on a number of different datasets with unique index_id(column1).
Could you please help me out with that? Thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品


リリース

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by