答案1
\documentclass{article}
\usepackage{nicematrix}
\usepackage{makecell}
\begin{document}
\begin{table}
\caption{The Caption}
\centering
\begin{NiceTabular}{*{7}{c}}[vlines,cell-space-limits=3pt]
\Hline
&\Block{1-2}{D1}
&
&\Block{1-2}{D2}
&
&\Block{1-2}{D3}
& \\\Hline
&P
&N
&P
&N
&P
&N \\\Hline
P&1&2&3&4&5&6 \\\Hline
N&1&2&3&4&5&6 \\\Hline
\end{NiceTabular}
\end{table}
\end{document}
或者
\documentclass{article}
\usepackage{nicematrix}
\usepackage{makecell}
\begin{document}
\begin{table}
\caption{The Caption}
\centering
\begin{NiceTabular}{*{7}{c}}[vlines,cell-space-limits=3pt]
\Hline
&\Block{1-2}{D1}
&
&\Block{1-2}{D2}
&
&\Block{1-2}{D3}
& \\\Hline
&P
&N
&P
&N
&P
&N \\\Hline
P&1&2&3&4&5&6 \\\Hline
N&1&2&3&4&5&6 \\\Hline
&\Block{1-2}{D4}
&
&\Block{1-2}{D5}
& \\\Hline
&P
&N
&P
&N \\\Hline
P&1&2&3&4 \\\Hline
N&1&2&3&4 \\\Hline
\end{NiceTabular}
\end{table}
\end{document}
答案2
平均能量损失
\documentclass[12pt]{article}
\usepackage{color}
\usepackage{array}
\usepackage{float}
\usepackage{multirow}
\providecommand{\tabularnewline}{\\}
\begin{document}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multirow{2}{*}{Dataset} & \multicolumn{2}{c|}{M1} & \multicolumn{2}{c|}{M2}\tabularnewline
\cline{2-5} \cline{3-5} \cline{4-5} \cline{5-5}
& X & Y & X & Y\tabularnewline
\hline
D1 & & & & \tabularnewline
\hline
D2 & & & & \tabularnewline
\hline
D3 & & & & \tabularnewline
\hline
D4 & & & & \tabularnewline
\hline
\multirow{2}{*}{Dataset} & \multicolumn{2}{c|}{M3} & \multicolumn{2}{c|}{M4}\tabularnewline
\cline{2-5} \cline{3-5} \cline{4-5} \cline{5-5}
& X & Y & X & Y\tabularnewline
\hline
D5 & & & & \tabularnewline
\hline
D6 & & & & \tabularnewline
\hline
D7 & & & & \tabularnewline
\hline
D8 & & & & \tabularnewline
\hline
\end{tabular}
\end{document}