How to create a Matrix with Label on its top?
With {bNiceMatrix}
of nicematrix
:
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\[T_i =
\begin{bNiceMatrix}[first-row]
W_1 & W_2 & W_3 & \cdots & W_m \\
e_{11} & e_{22} & e_{31} & \cdots & e_{m1} \\
e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \\
e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \\
\vdots & \cdots & \cdots & \cdots & \vdots \\
e_{1K} & e_{2K} & e_{3K} & \cdots & e_{mK} \\
\end{bNiceMatrix}
\]
\end{document}
There is \bordermatrix
macro in plain TeX:
$$
\delcode`(=\delcode`[ \delcode`)=\delcode`]
T_i =
\bordermatrix{ & W_1 & W_2 & W_3 & \cdots & W_m \cr
& e_{11} & e_{21} & e_{31} & \cdots & e_{m1} \cr
& e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \cr
& e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \cr
& \vdots & \cdots & \cdots & \cdots & \vdots \cr
& e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \cr }
$$
\bye
You are almost done, you only need to change tip of brackets in block
and replace matrix elements, where you like to have dots with \cdots
for horizontal dots and \vdots
for vertical:
\documentclass{article}
\usepackage{blkarray}
\begin{document}
\[T_i =
\begin{blockarray}{ccccc}
W_1 & W_2 & W_3 & \cdots & W_m \\
\begin{block}{[ccccc]} % <--- observe [ and ]
e_{11} & e_{22} & e_{31} & \cdots & e_{m1} \\
e_{12} & e_{22} & e_{32} & \cdots & e_{m2} \\
e_{13} & e_{23} & e_{33} & \cdots & e_{m3} \\
\vdots & \cdots & \cdots & \cdots & \vdots \\ % <--- observe dots
e_{1K} & e_{2K} & e_{3K} & \cdots & e_{mK} \\ % <--- observe dots
\end{block}
\end{blockarray}
\]
\end{document}
Code is simple and for final result need only one compilations.