How to store value of rand() function in a file?
Mostrar comentarios más antiguos
I want to store the value of rand()(this function generate a number of value randomly) function in a file. Can anyone help please??
Respuesta aceptada
Más respuestas (2)
Chad Greene
el 7 de En. de 2015
x = rand(5,1);
save example.mat 'x'
is simple and can be easily recalled with
load example
Alternatively, you may look into controlling random number generation with rng. By controlling the seed number you can consistently get the same "random" numbers every time you call rand.
Sean de Wolski
el 7 de En. de 2015
Or:
matlab.io.saveVariablesToScript
If you want a runnable script.
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!