Given a matrix, say which has Indeterminate and we want to change all these entries in the matrix by zero.
mat = {{-1., -1., Indeterminate, -1., -1.}, {-1., -1., Indeterminate, -1., -1.}, {Indeterminate, Indeterminate, Indeterminate, Indeterminate, Indeterminate}, {-1., -1., Indeterminate, -1., -1.}, {-1., -1., Indeterminate, -1., -1.}} p = Position[mat, Indeterminate] mat = ReplacePart[mat, p -> 0] Out[169]= {{-1., -1., 0, -1., -1.}, {-1., -1., 0, -1., -1.}, {0, 0, 0, 0, 0}, {-1., -1., 0, -1., -1.}, {-1., -1., 0, -1., -1.}}
another example, given a matrix of values, replace those values which are less than \(0.5\) by NULL
n = 5; a = Table[RandomReal[], {n}, {n}]; p = Position[a, x_ /; x < 0.5]; a = ReplacePart[a, p -> Null] Out[173]= {{Null, Null, Null, 0.6781657418995635, 0.7290662037036753}, {Null, 0.7084980071179792, Null, Null, 0.5811489862295911}, {Null, Null, 0.8467863882617719, Null, 0.8891915946646993}, {0.8173279058333203, 0.7272894246356278, Null, Null, 0.8665880423275274}, {Null, Null, 0.662026816962838, 0.5982839657423036, 0.6603967280952212}}