Select value from the list by defining criteria

1 回表示 (過去 30 日間)
Shiba Subedi
Shiba Subedi 2019 年 9 月 30 日
コメント済み: Adam Danz 2019 年 10 月 2 日
Dear All,
I have a big dataset with the format,
1 2019-09-25 19:33:00 27.7100 86.3200 10 291.122 4.00 1.79 R023E
1 2019-09-25 19:33:00 27.7100 86.3200 10 197.274 4.00 4.44 S8618
1 2019-09-25 19:33:00 27.7100 86.3200 10 170.200 4.00 4.14 RA5AB
I would like to have new set of data
(i) If column 10 has always valule R023E
(ii) If column 7 > 30.00
what is the solution?

採用された回答

Bob Thompson
Bob Thompson 2019 年 9 月 30 日
I would use readtable to import the data, the logic indexing to narrow down the results.
data = readtable('mydata.xlsx');
reducedata = data(data(:,10) == 'R023E' & data(:,7) > 30,:);
  7 件のコメント
Bob Thompson
Bob Thompson 2019 年 10 月 2 日
I would agree that dot indexing is more efficient, but I assumed that variable names were inconsistent or unknown.
Adam Danz
Adam Danz 2019 年 10 月 2 日
That's a good point. However, the variable names can be set in readtable() or after the table is created. If it is known that the data in column #7 is needed, they can name that column anything they want.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by