Select random numbers form matrix

1 Ansicht (letzte 30 Tage)
k khaja
k khaja am 25 Mär. 2021
Kommentiert: k khaja am 29 Mär. 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

Akzeptierte Antwort

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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by