Select random numbers form matrix

1 次查看(过去 30 天)
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 个评论
Matt J
Matt J 2021-3-25
You're welcome, but please Accept-click the answer to indicate that your problem is resolved.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by