Share Data Among Callbacks
2 Copy the example code.
copyfile(fullfile(docroot, 'techdoc','creating_guis',...
'examples','sliderbox_guidata.*')),...
fileattrib('sliderbox_guidata.*', '+w');
3 Display this example in the GUIDE Layout Editor:
guide sliderbox_guidata.fig
(^4) View the code in the Editor by clicking the Editor button,.
(^5) Run the program by clicking the Run Figure button,.
Sharing Data Among Multiple GUIDE UIs
Example of Sharing Data Between Two UIs
To see a full-featured example that uses application data and the guidata function to
share data between two separate UIs, use these steps to copy, run, and examine the code.
1 Set your current folder to one to which you have write access.
2 Copy the example code with this command:
copyfile(fullfile(docroot, 'techdoc','creating_guis','examples'...
,'changeme.')),fileattrib('changeme.', '+w');
3 Display the UIs in two GUIDE Layout Editors with these commands:
guide changeme_main
guide changeme_dialog
(^4) View the code in the editor by clicking the Editor button, , in both Layout Editors.
(^5) Run the changeme_main program by clicking Run Figure button, , in that UI’s
Layout Editor.
Example of Sharing Data Among Three UIs
To see a full-featured example that uses guidata and UserData data to share data
among three UIs, use these steps to copy, run, and examine the code.
1 Set your current folder to one to which you have write access.
2 Copy the example code with this command