Czy mógłby ktoś poprawić ten program aby poprawnie ustawiał ciąg liczbowy:

function a=quick_sortq(l,r)
a=[3 1 4 6 9 0];
l=0;
r=length(a);
i=l;
j=r;
element=((l+r)/2);
while i<j;
for i=1:i+1
a(i)<element;
end
for j=1:j-1
a(j)>element;
end
if i<=j
temp=a(i);
a(i)=a(j);
a(j)=temp;
end
end