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

 Accepted Answer

Matt J
Matt J on 25 Mar 2021
With repetition: Use randi()
Without repetition: Use randperm()

3 Comments

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

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 25 Mar 2021

Commented:

on 29 Mar 2021

Community Treasure Hunt

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

Start Hunting!