GUI: How to save figure properties to files?
Show older comments
Hi all, I would like to save figure properties(legend,background colors...) to some kind of files, so that I can recall them later. I used guidata(hObject,handles) to pass the figure properties from one callback function to another: save_setup_Callback(hObject, eventdata, handles) Here's my code:
function save_setup_Callback(hObject, eventdata, handles)
configuration.x_axis=get(handles.x_axis,'String'); % save marked items in listboxes
configuration.y_axis=get(handles.y_axis,'String');
[FileName,FilePath]=uiputfile('configuration.mat','Save Configuration','Configuration');
if FileName == 0
msgbox('You have canceled saving the file (.mat)!','Warning: no files saved','warn');
else
file = strcat(FilePath,FileName);
save(file);
save(file,'-struct','handles2','legend','-append') % handles2 includes the figure properties
But then I got this error in command window when executing:
Error using save
The argument to -STRUCT must be the name of a scalar structure variable.
I personally think it's because legend is not a structure, but a ''1x1 Legend''. Also I'm not sure if ''Legend'' can be written into a .mat file. So how can I save such format to files? And in which format?
Thank you in advance :)
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Properties in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!