# depicting specific element of a table (knowing its position) in different color

there is some 20 Time 20 tables, in each step we choose one element randomly. how can show this random selected element with different color?

• Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Nov 13 '15 at 10:13
• Take a look at the answers to this question as well: Identifying locations of entries in an array. – MarcoB Nov 13 '15 at 15:46

We define a function f with the style of for the TextCell

Do[f[i, j] = Black, {i, 10}, {j, 10}]


We display the table as a Dynamicentity

Dynamic@TableForm[
Table[TextCell[Subsuperscript[X, i, j], f[i, j]], {i, 10}, {j, 10}]]


Now every time you do a random selection, you can change the style of that specific cell, which will be updated in a Dynamic way. As an example, every second a random item with a random colour.

Do[
Pause[1];
f[RandomInteger[10], RandomInteger[10]] =
Sequence @@ {Bold, RandomChoice[{Red, Blue, Green}],   Background -> Yellow}
, 100]


• how you saved the dynamic table as a ".gif" ? – jack cilba Nov 21 '15 at 1:45

For better presentation I've decreased size of matrices to 4.

n = 4;
MatrixForm[m = Array[Subscript[a, ##] &, {n, n}]]


With[{ij = {RandomInteger[{1, n}], RandomInteger[{1, n}]}},
ReplacePart[m, ij -> Style[m[[Sequence @@ ij]], Red]]
] // MatrixForm