I want this:

which is done with
\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{matrix}
\begin{tikzpicture}[
mygridmatrix/.style={matrix of nodes,
row sep=-\pgflinewidth, column sep=-\pgflinewidth,
nodes={draw, minimum size=1cm}, nodes in empty cells},
]
\matrix (m) [mygridmatrix]
{
&&&&&\
&&&&&\
&&&&&\
&&&&&\
&&&&&\
&&&&&\
};
\foreach \i [count=\xi from 0] in {1,...,6}{
\node also [label=above:\xi] (m-1-\i) {};
\node also [label=left:\xi] (m-\i-1) {};
}
\end{tikzpicture}
\end{document}
As you can see, \matrix draws the grid and later on \foreach adds labels to first row and column nodes.
I would like to include this second part into mygridmatrix definition. I know I could do it with
\matrix (m) [mygridmatrix]
{
|[label=left:0,label=above:0]|&|[label=above:1]| ....\\
|[label=left:1]|& ...\\
...
but I would prefer to declare some row 1/.style and column 1/.style which automatically declare add labels related with \pgfmatrixcurrentrow and \pgfmatrixcurrentcolumn (which are only known when TiKZ is building each node).
May be using some late code or execute at end cell but I couldn't find it.
Is it possible?



\hypertargetcommand provided byhyperrefthat allows a\labelto be put in a location otherwise unidentified in the "usual" manner. i don't know whether it would "survive" in such a localized environment, but it's what i would try if i needed it. – barbara beeton Feb 06 '15 at 16:38label(in TikZ sense) and not a\label(inhyperrefsense). I've changed title to make it clearer. – Ignasi Feb 06 '15 at 16:49