And, it is my understanding that the 4 and the 5 are for the order of the global and local error, respectively.
Your understanding is wrong.
The local error of a Runge–Kutta method of order $n$ is proportional to $h^n$.
What ode45
does is to estimate the solution (of one step) with two Runge–Kutta methods with local orders of 4 and 5, respectively (hence those numbers). It uses the solution of the 5th-order method to estimate the solution of the ODE and the difference between the solutions from the two methods to estimate the error of the integration. Mind you that this is only an estimate – if you knew the precise error, you would also have already solved the problem precisely.
To save computation time, the two Runge–Kutta methods are designed such that they use common intermediate results. Other embedded Runge–Kutta methods (i.e., Runge–Kutta methods with two numbers to indicate order) work similarly.
The error estimate is then used to optimise the step size: If the error is above a given tolerance (for each component), the step size is decreased until the error is below that tolerance. If the error is far below that tolerance, the step size in increased to save time. This tolerance is:
$$ \text{AbsTol}_i + \text{RelTol}·|\hat{y}_i|,$$
where $|\hat{y}_i|$ is the estimated solution.
ode45
makes use of a sophisticated error estimator (that's where the5
comes in) and reduces $h$ until the local error estimate satisfies (the sum of) both relative and global tolerance. $\endgroup$