hi everyone
I have a 20 by 10 matrix. I am running the following code to retrieve a random element from each row of the matrix. In this case, I need to create a 20 by 1 matrix at the end. I have written the following code but it does give me a shuffle of the first column alone.
sz=size(R,1);B=zeros(sz,1);i=1:20% for n=1:100
for j=1 for i=1:20 for row=1:20 M(i,j)=randi(length(R),20,1); B(i,j)=R(M(i,j)); end endend% end
Best Answer