MATLAB: Save / Load Gui handles

configurationguidehandlesmatfileMATLAB

Hi, I have written a GUI (guide) with lots of buttons and settings. I want to save the states and load them with the same gui. Unaffortunately if I save handles and load it, a new figure (or several figures) with the settings appear. How can I avoid it?
I also noticed, that the structure I load into the gui is written into the workspace after the callback is completed. The gui just recognises the struct as an empty struct.
Save state (inside save button Callback)
seq = handles;
save(filename,'seq');
end
Load state (inside load button callback)
seq = matfile(filename,'Writable',true);
handles = setSequency(hObject,handles,seq); % Sees seq as an empty struct
end

Best Answer

Hi, after a long discussion with Mathworks support, it seems that there is no ways to save/load a figure handle directly and still access to the main output call of the UI like : Output=MyUI(SavedHandle).
You have to write loops to save each and every variable from your GUI into a MAT file and then load them to finally set again each and every control from your GUI to the loaded variable.
Not convenient at all.