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

8 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by