Here is an simple example:
I define an ode45 function and call it :
Function code
After running it, we can see that Only state variables of the function can be stored in the workspace and other intermediate cannot stored in the workspace.
Besides, the definition of ODE function only return state variables, which is different from other matlab functions that we can define your own output variables. If I want to make intermediate variables q_d and e_q can be also stored in the workspace in the form of an array “901x2”double, as same as the form of state variables. How can I do to achieve it.