It's very convenient if it was possible to use colon operator on a expression. Well to my knowledge, it's not possible. For example when I want to calculate the differences between two matrices, I have to do it in two lines.
diff = (a - b);
err = sum(abs(diff(:)));
instead of
diff = sum(abs((a-b)(:)));
Is there anyway around it?