Z=[22,45,65,35,65,54,45,67,84,95,86,58,29,95,93]; How to choose 5 random numbers from these numbers?? So that the output is within these numbers??

 Respuesta aceptada

Star Strider
Star Strider el 12 de Jul. de 2017

0 votos

One approach:
Z=[22,45,65,35,65,54,45,67,84,95,86,58,29,95,93];
Out = Z(randperm(numel(Z),5))
The randperm function will create random indices for 5 elements of ‘Z’ without repetition.

2 comentarios

mohammed elmenshawy
mohammed elmenshawy el 13 de Jul. de 2017
thank u very much
Star Strider
Star Strider el 13 de Jul. de 2017
My pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 12 de Jul. de 2017

Comentada:

el 13 de Jul. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by