Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Curious
Posts:
1,930
Registered:
12/6/04


Re: Random Selection of Nonconsecutive numbers
Posted:
Nov 6, 2013 5:19 PM


"nayyer " <n.saleem@student.utwente.nl> wrote in message <l5ecq1$mnt$1@newscl01ah.mathworks.com>... > Hi, > suppose i have a matrix of 3*2500 dimension. In the 3rd row i have the values which are not consecutive and have no order. I want to select randomly 4 values each time from 3rd row. remember that values are not consecutive. > Thanks
% One method would be to use RANDPERM
doc randpem
% something like: m = rand(3,2500); % (for each time) n = randperm(2500); values_4 = n(1:4); m(3,n) % I don't have MATLAB installed on this computer. % So, I'm not exactly sure about the syntax of the last statement. % But it should be close.



