MATLAB Answers

Generating random number from a vector

60 views (last 30 days)
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.

  0 Comments

Sign in to comment.

Accepted Answer

Guillaume
Guillaume on 10 Jan 2015
A(randi(numel(A))

  1 Comment

Aftab Ahmed Khan
Aftab Ahmed Khan on 10 Jan 2015
Thank you, it worked the way i wanted it to. take care.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!