How to generate a set of random numbers 1000 times.

5 Ansichten (letzte 30 Tage)
Sarah E
Sarah E am 30 Sep. 2014
Beantwortet: Image Analyst am 30 Sep. 2014
I want to generate n random numbers between certain values 1000 times. I known how to generate the numbers once, but what statement will repeat that task a defined number of times in this case 1000. I then need to write all the values produced to either a csv or excel file.

Antworten (1)

Image Analyst
Image Analyst am 30 Sep. 2014
Did you check the help for rand(), the first example?
data = a + (b-1)*rand(1000, n);
Each row will have your n random values. To write to a csv file, use csvwrite()
csvwrite(filename, data);

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by