Don't use sum() as the name of your variable! You're destroying a built-in function. I wish we could make this a sticky on the forum because it happens so often, probably more often than people confusing (row,column) with (x,y).
Use tril and fliplr like this:
m = magic(9)
lowerRight = fliplr(tril(fliplr(m)))
theSum = sum(lowerRight(:))