how to use randperm with a seed?

7 visualizaciones (últimos 30 días)
Kobi
Kobi el 29 de Oct. de 2014
Respondida: James Tursa el 29 de Oct. de 2014
while using randperm function i need matlab to remember the previous values and not to repeat them in the next run (inside a loop) how can i do this?

Respuestas (1)

James Tursa
James Tursa el 29 de Oct. de 2014
In general you will get a different set by default, but it is possible to get the same set. If you want to preclude this I would suggest writing your own function that calls randperm. In your function, store the most recent result in a persistent variable. You can then compare this on each call to guarantee that successive sets are not the same.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by