Logical Indexing Data Issue
古いコメントを表示
I'm working on a project where I'm given a large matrix. I'm trying to isolate all third column values that fit into a certain group (ie an array of all values in the third column when column 1 is equal to 5 and column 2 is equal to 4). I've tried using logical indexing to accomplish this but have so far failed. Any help would be greatly appreciated.
採用された回答
その他の回答 (1 件)
myMatrix = randi( 10, 1000, 3 );
condition = myMatrix( :, 1 ) == 5 & myMatrix( :, 2 ) == 4;
result = myMatrix( condition, 3 );
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!