how to randomly select an element in a matrix

조회 수: 1 (최근 30일)
cgo
cgo 2015년 10월 19일
댓글: PANTHAGADA ANIL KUMAR 2020년 4월 2일
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 CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by