MATLAB: How to choose one element form a row array randomly

arrayrandom

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.

Best Answer

result = T(randi(numel(T)));