In order to do this, consider using the 'CreateFcn' callback for a figure. This callback is designed to execute when a figure is created or opened. Using the 'CreateFcn' figure callback to set the zoom option to be on will allow the figure to be zoomable when it opens.
For example, refer to the following lines of code:
>> f=figure;
>> plot(1:10);
>> zoom on
>> f.CreateFcn='zoom on';
>> savefig('Test1')
After executing the code and opening the 'Test1.fig' file in MATLAB, the zoom option should be set to 'on'. For details of each line of code above, refer to the comment at the end of each line. For more information about figure callbacks and properties, please refer to the following link:
https://www.mathworks.com/help/matlab/ref/matlab.ui.figure-properties.html
Best Answer