Select random numbers form matrix

2 vues (au cours des 30 derniers jours)
k khaja
k khaja le 25 Mar 2021
Commenté : k khaja le 29 Mar 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

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by