Triangular Matrix creation

Is there an efficient way to create a lower or upper triangular matrix from a regular NxN dense matrix?

So half of the matrix below/above the diagonal are replaced with zero’s.