logical indexing is usually faster than find
이전 댓글 표시
j=find(si);
s1=f(j);
logical indexing is usually faster than find,What does this mean,please give solution
댓글 수: 1
Jan
2013년 3월 13일
Did you search for "logical indexing" in the documentation already? Even searching in the net for "Matlab logical indexing" will find many answers.
채택된 답변
추가 답변 (1개)
ChristianW
2013년 3월 13일
n = 1e6;
r = rand(n,1);
f = randn(n,1)+10;
si = r>0.5;
tic
j = find(si);
s1 = f(j); % with FIND
toc
tic
s2 = f(si); % with logical indexing
toc
all(s1==s2)
카테고리
도움말 센터 및 File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!