Improve performance, use logical indexing instead of FIND?!!

8 ビュー (過去 30 日間)
Mohammed
Mohammed 2014 年 9 月 22 日
回答済み: Image Analyst 2014 年 9 月 22 日
I was trying to improve my code but there is a message for the following code that I do not comprehend it. Any Solutions/idea/explanation?!
indices = find(NSet(:,4)~=0);
NSet = NSet(indices,[2:3, 5:clmNSet]);
Message: "To Improve performance, use logical indexing instead of FIND"
Thanks.

採用された回答

Image Analyst
Image Analyst 2014 年 9 月 22 日
You don't need find. Use logical indexes:
logicalIndices = NSet(:,4)~=0;
NSet = NSet(logicalIndices,[2:3, 5:clmNSet]);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by