Vector of upper triangle

M[triu(trues(M))]

See also Half Vectorization

3 Likes