how to randomly select an element in a matrix

1 回表示 (過去 30 日間)
cgo
cgo 2015 年 10 月 19 日
Hi,
I have a matrix for example A = [1,2,3,4,5,6]; I would like to randomly select an element in A.
How do I do that?

採用された回答

Walter Roberson
Walter Roberson 2015 年 10 月 19 日
A(randi(numel(A)))
  1 件のコメント
PANTHAGADA ANIL KUMAR
PANTHAGADA ANIL KUMAR 2020 年 4 月 2 日
how do i know which element it has randomly selected ???

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by