How can I output a series of data, ranging from s00, s01, s02, s10, s11, s12, s20, s21, s22; by writing a table with s is a fixed, and m and n are running parameters, for example:

Table[ToString[smn], {m,0,2},{n,0,2}] ?

This above command fails, because it outputs something that I don't aim for:

{{0,0,0},{0,s,2 s},{0,2 s,4 s}}

but I wish to have an output like:

{{s00, s01, s02}, {s10, s11, s12}, {s20, s21, s22}}

So how should I modify my Table?

  • 4
    $\begingroup$ wonderich, I think this question could be considered a duplicate of mathematica.stackexchange.com/q/20412/121 e.g. Table[ToString @ Row @ {s, m, n}, {m, 0, 2}, {n, 0, 2}]. Please let me know if you agree. $\endgroup$
    – Mr.Wizard
    Dec 3, 2016 at 6:45
  • 1
    $\begingroup$ In addition, smn is a single symbol. $\endgroup$
    – Yves Klett
    Dec 3, 2016 at 7:02
  • $\begingroup$ Thank you everyone, m_goldberg gives a much easier answer that seems to be appropriate for others to follow. So it is valuable to keep m_goldberg 's answer. $\endgroup$
    – wonderich
    Dec 3, 2016 at 16:18

1 Answer 1


Two minor variations on your code will do it.

Table[StringJoin["s", ToString /@ {m, n}], {m, 0, 2}, {n, 0, 2}]


Table["s" <> ToString[m] <> ToString[n], {m, 0, 2}, {n, 0, 2}]

Both produce

{{"s00", "s01", "s02"}, {"s10", "s11", "s12"}, {"s20", "s21", "s22"}}


Not the answer you're looking for? Browse other questions tagged or ask your own question.