[Tex/LaTex] Table reference doesn’t work

cross-referencingtables

I'm trying to reference a basic table in my Latex and it doesn't work.
I have another table in my document which is referenced the same way and the other table reference is working.
The label is in the caption itself and I compiled more than twice and I still get the warning that the reference is undefined (it doesn't print any number but ??).

I'm trying to reference the table in the paragraph before it (via \ref{caption}), but it doesn't change anything if I put the table before the paragraph.
I have to say it was working before I made some changes to the content but I don't have any other warning except this one and the table prints perfectly.
Here is the code:

\documentclass[conference,onecolumn]{IEEEtran}
\usepackage[table,xcdraw]{xcolor}
\begin{document}
Blah blah \ref{caption}.
\begin{table*}[H]
\centering
\caption{My caption \label{caption}}
\begin{tabular}{|c|c|c|}
\hline
 column 1 & column 2 & column 3 \\ \hline
\end{tabular}
\end{table*}
\end{document}

Does anyone of you have a clue of what happened?
I also tried to delete and regenerate the Aux file but it didn't work. And when I put the label somewhere else (referencing the section for example) it works perfectly.

EDIT: It seems that the reason is the '*' I put after table. When I remove it, it works. Can someone explain me why ? Thank you in advance

Best Answer

Changing [H] to [h] addresses the problem.

\documentclass[conference,onecolumn]{IEEEtran}
\usepackage[table,xcdraw]{xcolor}

\begin{document}
Blah blah \ref{caption}.
\begin{table*}[h]
\centering
\caption{My caption \label{caption}}
\begin{tabular}{|c|c|c|}
\hline
 column 1 & column 2 & column 3 \\ \hline
\end{tabular}
\end{table*}
\end{document}

enter image description here

Related Question