フィルターのクリア

Generate random numbers from a vector

1 回表示 (過去 30 日間)
Angus Wong
Angus Wong 2019 年 10 月 3 日
コメント済み: Angus Wong 2019 年 10 月 3 日
I would like Matlab to give me a number from a given row vector, such as:
A=[1 3 5 9 100 150 658 999];
Matlab would either give me 1,3,5,9,100,150,658, or 999 in a random manner.(Only one output.)
How can I do this? Many thanks.

採用された回答

the cyclist
the cyclist 2019 年 10 月 3 日
Here's one way:
A(randi(numel(A)))
  1 件のコメント
Angus Wong
Angus Wong 2019 年 10 月 3 日
Thank you for the quick response!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by