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

 采纳的回答

Matt J
Matt J 2021-3-25
With repetition: Use randi()
Without repetition: Use randperm()

3 个评论

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.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by