a – sparse matrix f – fraction which should be removed
I tried:
nonZeros = nnz(A);[i,j,s] = find(A);s = RandStream('mt19937ar','Seed',0);selection = randperm(s,floor((1-f/100) * nonZeros));i = i(selection);j = j(selection);s = s(selection);A = sparse(i,j,s);
On line "i = i(selection);" I get the error message: "You cannot index into a RandStream using () indexing."
Best Answer