2.12) Order Of Calculations
- Brackets (parenthesis), inner to outermost
- Exponentiation
- Multiplication and division (equal importance)
- Addition and subtraction (equal importance)
- Since brackets take precedence over all operators, they effectively give control to you.
- It is often helpful to use brackets even when not strictly necessary, so that the intended ordering is clearer.
The last examples highlighted the importance of the order in which Matlab solves commands. The standard order of evaluation for arithmetic operations (operator precedence) is similar to other languages:
The use of brackets helps user readability and reduces the likelihood of errors.