I’ll use the example in your comment: $M=\pmatrix{4&2&1\\0&1&3}$, with respect to the bases $\beta=\{v_1=[1,0,0],v_2=[1,1,0],v_3=[1,1,1]\}$ and $\beta\,'=\{w_1=[1,0],w_2=[1,1]\}\;.$
This transformation takes as input a column vector $v=\pmatrix{\alpha_1\\\alpha_2\\\alpha_3}$
representing the linear combination $\alpha_1v_1+\alpha_2v_2+\alpha_3v_3$ of basis vectors in $\beta$ and produces as output the product
$Mv=\pmatrix{4&2&1\\0&1&3}\pmatrix{\alpha_1\\\alpha_2\\\alpha_3}=\pmatrix{4\alpha_1+2\alpha_2+\alpha_3\\\alpha_2+3\alpha_3}\;.$
The entries $4\alpha_1+2\alpha_2+\alpha_3$ and $\alpha_2+3\alpha_3$ are then to be interpreted as coefficients of the vectors $w_1$ and $w_2$ in $\beta\,'$:
$T(v)=(4\alpha_1+2\alpha_2+\alpha_3)w_1+(\alpha_2+3\alpha_3)w_2\;.$
If you want to know what this looks like in terms of the standard basis $\{[1,0],[0,1]\}$, just multiply out:
$\begin{align*} T(v)&=(4\alpha_1+2\alpha_2+\alpha_3)\pmatrix{1\\0}+(\alpha_2+3\alpha_3)\pmatrix{1\\1}\\ &=\pmatrix{4\alpha_1+3\alpha_2+4\alpha_3\\\alpha_2+3\alpha_3}\;. \end{align*}$
Note that this is exactly what you get from the product
$AMv=\pmatrix{1&1\\0&1}\pmatrix{4&2&1\\0&1&3}\pmatrix{\alpha_1\\\alpha_2\\\alpha_3}\;,$
where $A=\pmatrix{1&1\\0&1}$ is a change-of-basis matrix: it translates a representation in terms of $\beta\,'$ into one in terms of the standard basis. It’s easy to construct this change-of-basis matrix: its columns are just the representations of $w_1$ and $w_2$ in terms of the standard basis.
It follows that if you start with $v$, representing a vector in $\Bbb R^3$ in terms of the basis $\beta$, and multiply it by the matrix $AM=\pmatrix{4&3&4\\0&1&3}\;,$ you get $T(v)$ expressed in terms of the standard basis for $\Bbb R^2$. Perhaps, though, you want to be able to input $v$ in terms of the standard basis for $\Bbb R^3$. Then you need another change-of-basis matrix, this time to convert from the standard basis for $\Bbb R^3$ to the basis $\beta$. We already know how to go the other way: to transform from a representation in terms of $\beta$ to one standard coordinates, multiply by the matrix $B=\pmatrix{1&1&1\\0&1&1\\0&0&1}$ whose columns are the representations of $w_1,w_2$, and $w_3$ in terms of the standard basis. (In other words, do exactly what we did to get $A$.) If you take the vector $\alpha_1v_1+\alpha_2v_2+\alpha_3v_3$, represented by the matrix $v=\pmatrix{\alpha_1\\\alpha_2\\\alpha_3}$ in terms of the basis $\beta$, you can find its representation in terms of the standard basis by multiplying by $B$ to get $Bv=\pmatrix{1&1&1\\0&1&1\\0&0&1}\pmatrix{\alpha_1\\\alpha_2\\\alpha_3}=\pmatrix{\alpha_1+\alpha_2+\alpha_3\\\alpha_2+\alpha_3\\\alpha_3}\;.$
Unfortunately, this isn’t quite what we need: we want to start with a vector $v$ in standard coordinates and convert it to one in $\beta$ coordinates so that we can multiply by $AM$ and get $T(v)$ in standard coordinates. That requires changing base from standard to $\beta$; multiplying by $B$ goes in the opposite direction, from $\beta$ coordinates to standard ones. As you might expect, the matrix that does the change of basis in the other direction is $B^{-1}$, which I’ll let you compute for yourself. Once you have it, you can express $T$ in terms of a matrix multiplication that involves standard coordinates on both ends:
$T(v)=AMB^{-1}v$
gives $T(v)$ in standard $\Bbb R^2$ coordinates if $v$ is expressed in standard $\Bbb R^3$ coordinates.