I am having trouble wrapping a tikzpicture, which is a matrix of nodes, within a subfigure. I would like this tikzpicture to be captioned and labelled. However I am getting the following error:
Undefined control sequence.
<argument> \pgf@matrix@last@nextcell@options
l.23 }
?
Here is the code that reproduces the issue.
\documentclass[12pt]{book}
\usepackage{subfigure}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{figure}[ht]
\centering
\subfigure[Laplacian $9 \times 9$ filter]{
\begin{tikzpicture}[cell/.style={rectangle,draw=black}]
\matrix[matrix of nodes]{
0& 0& 1& 1& 2& 1& 1& 0& 0\\
0& 1& 3& 5& 5& 5& 3& 1& 0\\
1& 3& 5& 3& 0& 3& 5& 3& 1 \\
1& 5& 3& -12& -23& -12& 3& 5& 1 \\
2& 5& 0& -23& -41& -23& 0& 5& 2 \\
1& 5& 3& -12& -23& -12& 3& 5& 1 \\
1& 3& 5& 3& 0& 3& 5& 3& 1\\
0& 1& 3& 5& 5& 5& 3& 1& 0 \\
0& 0& 1& 1& 2& 1& 1& 0& 0 \\
};
\end{tikzpicture}
\label{fig:log-filter-discret}
}
\hspace{.2in}
\subfigure[LoG representation]{
\includegraphics[width=.45\linewidth]{log-img.png}
\label{fig:log-filter}
}
\caption{discretized LoG and its representation}
\end{figure}
\end{document}

{}on the gui. Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a\documentclasscommand, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code. – Oct 30 '18 at 07:49