mercredi 30 avril 2014

matlab array elements that meet a condition no loop


Vote count:

0




I have an array of elements and 2 other arrays

I'm doing something like this:



a=[1 3 2 45 4 23 16];
b=[3 9 1 27 33 50 5];
m=100;
k=linspace(min(a),max(a),m);
res=zeros(m,1);
for i=1:m
res(i) = sum((a < k(i))*(b < k(i)));
end


Is there any way to get the same result with no loops?



asked 42 secs ago






Aucun commentaire:

Enregistrer un commentaire