How to generate a set of random numbers 1000 times.

조회 수: 6 (최근 30일)
Sarah E
Sarah E 2014년 9월 30일
답변: Image Analyst 2014년 9월 30일
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.

답변 (1개)

Image Analyst
Image Analyst 2014년 9월 30일
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);

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by