I want to compute the L2 norm of a n-d matrix. I want to compute this in a single statement, without introducing temporal variables. But it seems I have to, because if I write it like this, it will complains unbalanced parenthesis,
sqrt(sum((A.^2)(:)))
So I have to introduce a temporal matrix B, to write like this
B = A.^2
sqrt(sum(B(:)))
Is there any technique I can use to avoid this? I also found that if a function returns a matrix, I also cannot write like this
(fun(A))(:)
My main concern is why the operator precedence does not work here.