how to obtain random vector from the defined matrix
3 views (last 30 days)
Show older comments
suppose, for c matrix c=[1 2 3; 3 4 5;6 7 8;9 10 11;12 13 14;15 16 17];
randomly i have to select any row vector.
0 Comments
Accepted Answer
KSSV
on 22 Nov 2021
c=[1 2 3; 3 4 5;6 7 8;9 10 11;12 13 14;15 16 17];
[m,n] = size(c)
idx = randsample(m,1)
iwant = c(idx,:)
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!