Problems with 'save' and 'uicontrol' with Matlab 2015 release. What has changed? Each time I click on a checkbox a new window opens...
2 views (last 30 days)
Show older comments
In 2012 I had programmed a code for solving trigonometry problems by using GUI commands such as 'uicontrol' and savings of the current workspace variables and handles with 'save'. The code was fully operational and distributed to my students. The problem is that the same code does not work with 2015 Matlab release. Each time I click on a checkbox a new window opens and an warning message is produced:
Warning: Figure is saved in trigoplana_dat.mat. Saving graphics handle variables can cause the creation of very large files. To save graphics figures, use savefig.
I copy here the code for creating the figure:
figNumber=figure( ...
'Name','Trigo Plana', ...
'Units','normalized', ...
'Position',[0.2,0.2,0.7,0.7], ...
'NumberTitle','off');
The code for one of the checkbox:
handles.ha=zeros(1,4);
handles.ha(1)=uicontrol('Style', 'checkbox', 'String','a', 'Position', [x0, y0,dx,dy],'Callback',...
'load(''trigoplana_dat'');uienableplana(handles.ha(3:4));save(''trigoplana_dat'',''-append'')');
The line for the saving:
save ('trigoplana_dat')
Please, if anyone can help me to understand the changes made in this new Matlab release which can help me to solve this problem I would be very grateful
0 Comments
Answers (1)
Steven Lord
on 2 Feb 2016
In the new graphics system introduced in release R2014b, figure handles are now objects. By calling SAVE with just one input, you're telling MATLAB to save everything which includes the figure. The warning indicates that saving these figure objects in a MAT-file may result in very large files, to alert you to the fact that you may want to be more selective in what you SAVE.
To avoid this, specify the exact variables you want to save in the MAT-file (and don't specify the variable containing the figure handle) by passing their names into the SAVE function as the second, third, etc. inputs.
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!