To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
I would to generate a probability random matrix with two constraints: the first is that the sum of the values of the row must be equal to 1 and the second is that one element of each row has to be a value greater than 0.5. I have written this:
if true for l=1:n while (nnz(random_data(l,:)) < d) m=randi(d,1,1); if (random_data(l,m)==0) row_sum=sum(random_data(l,:)); if(row_sum == 0) random_data(l,m)=0.5+0.5*rand(1,1); else if(nnz(random_data(l,:))==(d-1)) random_data(l,m)=1-row_sum; else random_data(l,m)=(1-row_sum)*rand(1,1); end end end end end end It is very inefficient. Can you help me?
No products are associated with this question.