function boxplot_test
boxplot(rand(100,10));
ax1 = gca;
ax2 = axes('Position', get(ax1, 'Position'), ...
   'Color', 'none', 'YAxisLocation', 'right', ...
   'XTick', [], 'YTick', get(ax1, 'YTick'), ...
   'YLim', ylim(ax1), 'HandleVisibility', 'off');
uistack(ax1);
% set(gcf, 'ResizeFcn', @resize);
h = zoom(gcf);                           % <-- EDIT 2
% set(h, 'ActionPostCallback', @resize);   % <-- EDIT 2
%      function resize(varargin)
%         set(ax2, 'Position', get(ax1, 'Position'), ...
%            'YTick', get(ax1, 'YTick'), ...
%            'YLim', ylim(ax1));
%      end
end