I have a matrix B of 0's and 1's, and I have selected the rows and columns that contain the 1's. I now want to randomly choose some of these rows to change the value. I have a rate beta of how many of the rows I need to change. So I want the row and column numbers of the matrix that need to be changed, and then I need to change them. This is the code that I tried to use
B = [0,1,0;0,0,0;0,1,0]
beta = 0.6
[rows,cols]=find(B);
infInd=rows(randn(length(rows)))
Best Answer