Multi column and multi row table in LaTeX?

How do I draw the following table in LaTeX? The data inside is not that important.

enter image description here

I wrote the following code:

\begin{table}[H] \centering \begin{tabular}{cccccc} \hline \multicolumn{6}{|c|}{Feature Vector of Samples} \\ \hline \headerrow & 1 & 2 & 3 & 4 & 5\\ 1 & \(9.87*e^{-01}\) & \(8.67*e^{-17} \)& \(4.13*e^{-24}\) & \(1.16*e^{-17}\) & \(4.58*e^{-17}\) \\ 2 & \(1.16*e^{-16}\) & \(9.99*e^{-01}\) & \(9.14*e^{-25}\) & \(3.63*e^{-22}\) & \(2.69*e^{-11}\) \\ 3 & \(4.35*e^{-33}\) & \(7.85*e^{-34}\) & \(9.93*e^{-01}\) & \(3.74*e^{-04}\) & \(4.55*e^{-34}\) \\ 4 & \(5.51*e^{-26}\)& \(5.13*e^{-31}\)& \(5.02*e^{-04}\) & \(9.99*e^{-01}\) & \(1.71*e^{-29}\) \\ 5& \(9.60*e^{-18}\) & \(2.21*e^{-07}\)& \(2.52*e^{-25}\)& \(4.64*e^{-20}\)& \(9.99*e^{-01}\) \end{tabular} \caption{wasssss} \label{tbl:wasss} \end{table} 

and here is the result:

enter image description here

What I need to add is one multi row, and the first row should not include the first column.

1

2 Answers

In theory you could create a table like this using the following code, but please have a look at before you inflict such a table on your readers

\documentclass{article} \usepackage{graphicx} \usepackage{multirow} \begin{document} \begin{table}[htbp] \centering \begin{tabular}{|c|c|c|c|c|c|c|} \hline \multicolumn{2}{|c|}{} &\multicolumn{5}{|c|}{Feature Vector of Samples} \\ \cline{3-7} \multicolumn{2}{|c|}{} & 1 & 2 & 3 & 4 & 5\\\hline \multirow{5}{*}{\rotatebox{90}{samples}} & 1 & \(9.87*e^{-01}\) & \(8.67*e^{-17} \)& \(4.13*e^{-24}\) & \(1.16*e^{-17}\) & \(4.58*e^{-17}\) \\\cline{2-7} &2 & \(1.16*e^{-16}\) & \(9.99*e^{-01}\) & \(9.14*e^{-25}\) & \(3.63*e^{-22}\) & \(2.69*e^{-11}\) \\\cline{2-7} & 3 & \(4.35*e^{-33}\) & \(7.85*e^{-34}\) & \(9.93*e^{-01}\) & \(3.74*e^{-04}\) & \(4.55*e^{-34}\) \\\cline{2-7} & 4 & \(5.51*e^{-26}\)& \(5.13*e^{-31}\)& \(5.02*e^{-04}\) & \(9.99*e^{-01}\) & \(1.71*e^{-29}\) \\ \cline{2-7} & 5& \(9.60*e^{-18}\) & \(2.21*e^{-07}\)& \(2.52*e^{-25}\)& \(4.64*e^{-20}\)& \(9.99*e^{-01}\)\\ \hline \end{tabular} \caption{wasssss} \label{tbl:wasss} \end{table} \end{document} 

enter image description here

you can use the excel2latex. It's a powerful tool for tables write. You'll need add the packagins after, like it's on the follow script:

\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{multirow} %for multirow \usepackage{rotating} %for sideways, rotating "samples" at 90°" \usepackage{bigstrut} %for bigstrut \begin{document} % Table generated by Excel2LaTeX from sheet 'Planilha1' \begin{table}[htbp] \centering \caption{Add caption} \begin{tabular}{|c|r|r|r|r|r|r|} \hline \multicolumn{2}{|c|}{\multirow{2}[4]{*}{}} & \multicolumn{5}{c|}{Feature Vector of Samples} \bigstrut\\ \cline{3-7} \multicolumn{2}{|c|}{} & 1 & 2 & 3 & 4 & 5 \bigstrut\\ \hline \multirow{5}[10]{*}{\begin{sideways}samples\end{sideways}} & 1 & Value & Value & Value & Value & Value \bigstrut\\ \cline{2-7} & 2 & Value & Value & Value & Value & Value \bigstrut\\ \cline{2-7} & 3 & Value & Value & Value & Value & Value \bigstrut\\ \cline{2-7} & 4 & Value & Value & Value & Value & Value \bigstrut\\ \cline{2-7} & 5 & Value & Value & Value & Value & Value \bigstrut\\ \hline \end{tabular}% \label{tab:addlabel}% \end{table}% \end{document} 

Sample

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like