random entry selection from a matrix

Antworten (1)

Doug Hull
Doug Hull am 23 Jul. 2012

0 Stimmen

v = [1:10]
vi = randi(numel(v));
choice = v(vi)

1 Kommentar

Doug, you missed your chance to say
choice = v(randperm(numel(v),1));

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 23 Jul. 2012

Community Treasure Hunt

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

Start Hunting!

Translated by