[Tex/LaTex] How do i remove the empty lines from table

tables

I am currently trying to remove the lines in the table, that doesn't contain anything.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage{float}

\begin{document}

\begin{table}[H]
    \begin{tabular}{ |p{3cm}||p{3cm}|p{3cm}|p{3cm}|p{3cm}| }
    \hline
    \multicolumn{4}{|c|}{Title} \\
    \hline
    Window size: 9 &  Results & Window size: 15 &  Results \\ 
    \hline
    Accuracy &  0.70 & Accuracy &  0.60  \\
    Validation accuracy&    0.19 & Validation accuracy&    0.16 \\  
    \hline
    Window size: 32 &  Results  \\
    \hline
    Accuracy &  0.14 \\
    Validation accuracy&    0.07 \\   
    \hline
    \end{tabular}
\end{table}

\end{document}

enter image description here

How do i remove the empty lines in this table?

Is there a simple way to remove it?..

Best Answer

You can use \cline{x-y} to make horizontal lines for specified columns.

There was one unused column, so I removed the last p{3cm}|.

For 4 equal columns you can also use: *4{p{3cm}|}.

\documentclass{article}
\usepackage{caption}

\begin{document}

\begin{table}
    \begin{tabular}{ |*4{p{3cm}|} }
        \hline
        \multicolumn{4}{|c|}{Title} \\
        \hline
        Window size: 9 &  Results & Window size: 15 &  Results \\ 
        \hline
        Accuracy &  0.70 & Accuracy &  0.60  \\
        Validation accuracy&    0.19 & Validation accuracy&    0.16 \\  
        \hline
        Window size: 32 &  Results  \\
        \cline{1-2}
        Accuracy &  0.14 \\
        Validation accuracy&    0.07 \\   
        \cline{1-2}
    \end{tabular}
\end{table}

\end{document}

enter image description here