特定の複数列から条件を指定し、複数の行を抽出する
Show older comments
以下のようなdatファイルをreadtableで読み込んだ際に、eventIDとnameが条件に一致する場合を取り出したいのですがうまくいきません
eventID energy x y z name
____ _______ _____ ______ _________ _________________
0 0.2007 477.8 0 -0.001755 {'Compton' }
0 0.07819 479.4 2.96 2.991 {'Compton' }
0 0.06179 482 2.418 4.056 {'Compton' }
0 0.1703 485.5 10.41 4.328 {'PhotoElectric'}
1 0.3191 407.7 0 -0.001498 {'Compton' }
1 0.03521 404 -3.865 1.617 {'Compton' }
1 0.0325 403.6 -3.799 3.284 {'Compton' }
2 0.1383 427.3 0 -0.001569 {'Compton' }
2 0.01936 471.1 -53.27 9.833 {'Compton' }
3 0.04832 463.8 0 -0.001704 {'Compton' }
・
・
・
・
10000 ・・・・・・・・
条件は、
eventID ・・・・ name
_______ _____________
15 {'Compton' }
15 {'PhotoElectric'}
と
eventID ・・・・ name
_______ _____________
27 {'Compton' }
27 {'Compton' }
27 {'PhotoElectric'}
のようなときの複数行を取り出したいです。これをeventIDが10000のところまで繰り返して行いたいです。
findで試してみたりしているのですが、tableからlogicalに変換できません とエラーが出てきてしまい、うまくいきません。
Accepted Answer
More Answers (0)
Categories
Find more on Other Formats in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!