Hello a question please.
I have matrix P with size (452*500). I want to select random selection with roulette wheel selection. I write something:
r=rand; c=reshape(p,1,[]); c1=cumsum(c); j=find(r<=c1,1,'first'); [j1 j2]=ind2sub(size(p),j);end
but I want to remove part " c=reshape(p,1,[]);" and create cumulative matrix of p directly without reshaping it to matrix c. How can I do it?
Thank you.
Best Answer