Faster alternate to all() function
I am running a simulation of 100s of thousands loop and I am noticing that inside the each loop an all() function consumes almost 95% of the time. I want a faster alternate to this.
So here is my algorithm:
varname=rand([24665846,4])
for i=1:1000000
idx=idxkeep(i);
ind1=all(varname(:,1:4)==varname(idx,1:4),2);
ind=find(ind1);
endI am running a simulation of 100s of thousands loop and I am noticing that inside the each loop an all() function consumes almost 95% of the time. I want a faster alternate to this.
So here is my algorithm:
varname=rand([24665846,4])
for i=1:1000000
idx=idxkeep(i);
ind1=all(varname(:,1:4)==varname(idx,1:4),2);
ind=find(ind1);
end I am running a simulation of 100s of thousands loop and I am noticing that inside the each loop an all() function consumes almost 95% of the time. I want a faster alternate to this.
So here is my algorithm:
varname=rand([24665846,4])
for i=1:1000000
idx=idxkeep(i);
ind1=all(varname(:,1:4)==varname(idx,1:4),2);
ind=find(ind1);
end matlab, all() MATLAB Answers — New Questions