Select random numbers form matrix

2 visualizaciones (últimos 30 días)
k khaja
k khaja el 25 de Mzo. de 2021
Comentada: k khaja el 29 de Mzo. de 2021
Can anyone help me, how can I choose 4 elelemts randomly from below matrix with and without repetaion.
P = ['a', 'b', 'c', 'd', '1', '2', '3', '4,']
Thanks in advance

Respuesta aceptada

Matt J
Matt J el 25 de Mzo. de 2021
With repetition: Use randi()
Without repetition: Use randperm()
  3 comentarios
Matt J
Matt J el 25 de Mzo. de 2021
You're welcome, but please Accept-click the answer to indicate that your problem is resolved.
k khaja
k khaja el 29 de Mzo. de 2021
Thanks a lot Matt, it works.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by