To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
Is there a possibility to replace the zeros in A by 1, and the 1's in A by zero with fixed probability?
A = [0,1,1,0,1,0,1,0] and I want to replace 0 by 1 with probability 1/4 and 1 by 0 with probability 1/3. Thank you.
No products are associated with this question.
You can use a for loop and counter. Might not be efficient. But still does the trick. Something like this,
for every element in A: if element in A is 0, and count of 0 is ==4:%this is for probability 1/4 A[i]==1; count=0;