Since nobody has posted a Matlab solution yet, here's a simple one-liner:
idxs = find(triu(true(size(A))))
Given matrix A, this will return a vector of all your indices, such that idxs(k) returns the k-th linear index into the upper triangular portion of the matrix.