Every function (including callback functions) has its own workspace. Each workspace has its own variables: this is a good thing! Many beginners want all variables to exist in every workspace, but this is not a good way to manage data.
You can easily pass variables between workspaces:
Writing nested functions is probably the easiest way to pass data between callback functions. Otherwise guidata is a good method to pick.
If you are passing data between functions that are not callbacks, passing arguments is the simplest, fastest, and most reliable.
