Filter löschen
Filter löschen

How to store 1000 random values in a single matrix

3 Ansichten (letzte 30 Tage)
Nicole Konforti
Nicole Konforti am 25 Jan. 2017
Beantwortet: Greg am 25 Jan. 2017
I want to be able to create a for loop that will 1. create a list of 1000 random numbers (between the value of 0 and 1) and then 2. save and store these values in a single variable that I can go back to at any time. I know that to make my for loop of 1000 values I use:
for K=1:1000
rand
end
However, I do not know how to then store these values in a single array. Thank you!

Antworten (1)

Greg
Greg am 25 Jan. 2017
Read the documentation for the rand() function.
yoursinglearray = rand(1000,1);

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