MATLAB: Generating random numbers using for loop

random number generator

Hi, Shall i use the following code to generate random numbers and use them further in the calculation?
clear all
close all
for n=1:2;
h(n)=rand
end

Best Answer

If you like. you could instead pass size information to rand to say how many items to generate .