I read the documentation for GUIDE and it suggests a couple of ways to share data between callbacks. My GUIDE application will have a figure, a bunch of GUI elements, and use global objects (i.e. I want them to be visible to all callbacks in the GUI's m file) that are initialized when the GUI is created but will be read and updated by various callbacks.
I am leaning towards using setappdata and getappdata because it seems most efficient and correct.
So suppose that upon GUI creation I instantiate an object of type vision.VideoFileReader and also an object of type vision.VideoFileWriter and store them in a struct called my_app_data, like this:
my_app_data.videoFileReader = vision.VideoFileReader;
my_app_data.videoFileWriter = vision.VideoFileWriter;
setappdata(handles.figure1, 'my_app_data', my_app_data);
my_app_data = getappdata(handles.figure1, 'my_app_data');
Is there a better way to pass global data like those heavy objects around between callbacks?