Generating random number from a vector

Hello everyone, If i have a vector like A = [1 2 3 4 5 6.......30] and i want to pick a random value from this vector A. How can i do that. Thank you so much.

 Accepted Answer

A(randi(numel(A))

1 Comment

Thank you, it worked the way i wanted it to. take care.

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!