Consider this simple code:
Grid[RandomInteger[{0, 1}, {10, 10}], Background -> LightBlue]
Is it possible to modify the code so that the background only apply for certain entries of the matrix, e.g. only for non zero entries?
Consider this simple code:
Grid[RandomInteger[{0, 1}, {10, 10}], Background -> LightBlue]
Is it possible to modify the code so that the background only apply for certain entries of the matrix, e.g. only for non zero entries?
Grid[Item[#, Background -> If[# == 1, Blue]] & /@ # & /@ RandomInteger[{0, 1}, {10, 10}]]

Grid[RandomInteger[{0, 1}, {10, 10}]] /. 1 -> Item[1, Background -> Blue]

Grid[m = RandomInteger[{0, 1}, {10, 10}],
Background -> {None, None, Thread[Position[m, 1] -> Blue]}]

r = RandomInteger[{0, 1}, {10, 10}];
bg = Thread[SparseArray[r]["NonzeroPositions"] -> LightBlue];
Grid[r, Background -> {None, None, bg}]