MATLAB: What changes should be made to speed up the given script

for loopMATLABscript

for n = 1:10000
x(n) = rand();
end

Best Answer

x = rand(1,10000);
no loop