China Naming Network - Ziwei Dou Shu - How to randomly select a few from one matrix and count them in another matrix in matlab, the position is the same as before.
How to randomly select a few from one matrix and count them in another matrix in matlab, the position is the same as before.
For example, you have to pick three at random.
n = 3;
la = numel(a);
t = 1;
p = rand perm(La);
ind = P( 1:n);
b = 0 * a;
b(ind)= a(ind);