MATLAB: How to randomly select an element in a matrix

arrayrandom

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?

Best Answer

A(randi(numel(A)))
Related Question