How to extract specific row data from a big matrix?
古いコメントを表示
Here are my data [1 5; 1 1; 1 2; 1 3; 1 1; 2 2; 2 2; 2 1; 2 3; 2 1] . Now, I want to extract the rows which have either 1 1, 1 2 , 2 1, or 2 2 and export it as a new data file. Any pointers on how to achieve this? I am able to extract by just one row value. For example, with the below code I get all the data that has 2 in the column 1. However, I do not know how to include both columns for all the above-mentioned cases i.e. 1 1, 1 2, 2 1, 2 2.
Code: data=[1 5; 1 1; 1 2; 1 3; 1 1; 2 2; 2 2; 2 1; 2 3; 2 1]; temp=data(data(:,1)==2,:);
Output: temp =
2 2
2 2
2 1
2 3
2 1
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!