Clear Filters
Clear Filters

Is it possible to obtain a random sample of values from a matrix without the randsample tool?

4 views (last 30 days)
Is it possible to obtain a random sample of values from a matrix without the randsample tool?

Accepted Answer

Azzi Abdelmalek
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))

More Answers (0)

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!