I am trying to get a random sample of a matrix which includes NaNs, but I need the indices as well.
I have tried randsample(matrix(~isnan(matrix)),10); but I get only the values of the matrix and not the index here. Since multiple positions may have the same value, the index is very important.
If my matrix is: [ NaN 2 3 3 4 5 1 NaN 6] and the random sample value is 3, I would like to also see the indices (2,1).
Aucun commentaire:
Enregistrer un commentaire