clcfunction y = sort( v ) n = length( v ); sorted = 0; k = 0; while ~sorted sorted = 1; k = k + 1; for j = 1:n-k if v(j) > v(j + 1) t = v(j); v(j) = v(j + 1); v(j + 1) = t; sorted = 0; end end end y = x;
This code ain't doing shit guys. What's wrong? Should I put v = input( 'vector? ' ) before the function or something? What's the point of the y = x;?
Best Answer