Let me preface that I am an absolute beginner with Matlab. I am trying to perform $PA=LU$ factorization on a matrix, however I am having difficulty with the permutation matrix. When I execute $[L,U,P]=lu(A)$, I want to be able to represent the permutation matrix as a one-dimensional array of integers recording which row interchanges have been made.
For example, if $P=[0 1 0 ; 1 0 0 ; 0 0 1]$, then I am looking to find how I can achieve an output of $p= [2 1 3]$.
I figure that there was an easy way to execute this result. I simply do not have the experience to figure it out on my own. Thank you.