Hi everybody, I was wondering how to change a while loop with an “if” condition to an a simple while. For example I got
n=100;x=rand(1,n);k=1;while k<nif x(k) > 0.95 break; end k=k+1; end disp([num2str(k), ‘ is the index of the first element in x that is greater than 0.95’]);Thanks
Best Answer