Select random numbers form matrix

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

 Risposta accettata

Matt J
Matt J il 25 Mar 2021

0 voti

With repetition: Use randi()
Without repetition: Use randperm()

3 Commenti

Matt J
Matt J il 25 Mar 2021
k khaja's comment moved here
Thanks a lot, it works well.
Matt J
Matt J il 25 Mar 2021
You're welcome, but please Accept-click the answer to indicate that your problem is resolved.
Thanks a lot Matt, it works.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Centro assistenza e File Exchange

Richiesto:

il 25 Mar 2021

Commentato:

il 29 Mar 2021

Community Treasure Hunt

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

Start Hunting!

Translated by