I have a transition matrix here (in Matlab code):
P = [0.2 0.8 0 0 0 0 0;
0.5 0.5 0 0 0 0 0;
0.5 0 0 0 0 0.5 0;
0 0 0.8 0 0.2 0 0;
0 1 0 0 0 0 0;
0 0 0 0 0 0.2 0.8;
0 0 0 0 0 0.5 0.5;];
% stationary distribution, denote as π
dis = null(P'-eye(7))./sum(null(P'-eye(7)))
Here, I solve the stationary distribution π=π*P and find that there is no unique form for π. I want to try solving $\lim_{n->\infty}{P^n}$ matrix as n goes to infinity the same way in the picture. So how can I achieve that? Thanks in advance. Picture of wanted method Picture of transition diagram for you guys to better see transience and recurrence

From your matrix and diagram, clearly states $1$ and $2$ are aperiodic positive recurrent, as are states $6$ and $7$. By contrast states $3,4,5$ are transient. On top of this, states $1$ and $2$ do not communicate with states $6$ and $7$ (and this leads to there not being a unique stationary distribution).
If you start in states $1$ or $2$, then the later distribution of being in each of those states will tend towards be in the ratio $0.5:0.8$, i.e. $\frac5{13}:\frac8{13}$
If you start in states $6$ or $7$, then the later distribution of being in each of those states will also tend towards be in the ratio $0.5:0.8$, i.e. $\frac5{13}:\frac8{13}$
So stationary distributions will be of the following form for some $k$ with $0 \le k \le 1$: $$\left(\frac5{13}k,\frac8{13}k,0,0,0,\frac5{13}(1-k),\frac8{13}(1-k)\right)$$
Starting from state $5$ you will end up in states $1$ or $2$ with probability $1$ and in states $6$ or $7$ with probability $0$; while starting from state $3$ you will end up in states $1$ or $2$ with probability $\frac12$, and in states $6$ or $7$ with probability $\frac12$; so starting in start $4$ gives a combination of those meaning you will end up in states $1$ or $2$ with probability $\frac35$, and in states $6$ or $7$ with probability $\frac25$
That will make
$$\lim\limits_{n->\infty}{P^n} = \begin{pmatrix} \frac5{13} & \frac8{13} & 0 & 0 & 0 & 0 & 0 \\ \frac5{13} & \frac8{13} & 0 & 0 & 0 & 0 & 0 \\ \frac5{26} & \frac4{13} & 0 & 0 & 0 & \frac5{26} & \frac4{13} \\ \frac3{13} & \frac{24}{65} & 0 & 0 & 0 & \frac{2}{13} & \frac{16}{25} \\ \frac5{13} & \frac8{13} & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \frac5{13} & \frac8{13} \\ 0 & 0 & 0 & 0 & 0 & \frac5{13} & \frac8{13} \end{pmatrix}$$
and as a check in R:
gives
as predicted