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 中查找有关 Audio Processing Algorithm Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!