To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
Itried to make my code be faster , so i used setdiff instead of a part in my code
v=(1:18); buf=setdiff(v,unique_x); relevant_item(ttt(i),1:length(buf))=buf;
*instead of *
for v=1:18 b2=find(unique_x==v); if isempty(b2) relevant_item(ttt(i),h)=v; h=h+1; end end
*why the running time of this part is less than of setdiff?
No products are associated with this question.
setdiff() essentially has to sort each time -- or at least to check if the set is ordered.
Are the unique_x restricted to being in the allowed range for v, 1:18 ? If so, then how about
buf = 1:10; buf(unique_x) = ; relevant_item(ttt(i),1:length(buf))=buf;