필터 지우기
필터 지우기

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

조회 수: 14 (최근 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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by