"nayyer " <firstname.lastname@example.org> wrote in message <email@example.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
% 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.