Hi Danial,
I understand that you want to modify the variables when the function train(agent,env) is running in MATLAB.
Editing variables during the execution of a function like train(agent, env) in MATLAB can be challenging because the function typically runs in a blocking manner, meaning it does not return control to the MATLAB command prompt until it completes. Therefore, usually it is not possible to modify the variables when the function is executing.
However, there are some other strategies that you may try exploring:
- Use Global Variables: These variables can be accessed and modified from any function. These can be used to store the rewards across episodes. This will then allow you to access and update the rewards by calling different functions.
- Callback Functions: Define callback functions that can be triggered to modify the variables during the training process.
- You can always try to define your own custom training loop. This will give you proper control over the training process and enable you to modify variables as needed.
Hope this helps!