Is it possible to obtain a random sample of values from a matrix without the randsample tool?
4 views (last 30 days)
Show older comments
Is it possible to obtain a random sample of values from a matrix without the randsample tool?
0 Comments
Accepted Answer
Azzi Abdelmalek
on 24 Nov 2012
Edited: Azzi Abdelmalek
on 24 Nov 2012
A=magic(6);
out=A(randi(numel(A),1))
if you want 3 values for example
out=A(randi(numel(A),3,1))
1 Comment
More Answers (0)
See Also
Categories
Find more on Random Number Generation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!