How can I choose one element form a row array randomly?

Good morning, I'm interested in choosing only one element from an array. e.g. i got the following array T=[0 1 2 3 4 5] but I want to get one element from it randomly. Thanks for your attention.

 Respuesta aceptada

James Tursa
James Tursa el 17 de Mayo de 2018
Editada: James Tursa el 17 de Mayo de 2018
result = T(randi(numel(T)));

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by