function abc
figure()
for ii = 1:4
subplot(2,2,ii)
plot(rand(10))
mySet(gca, gca)
end
end
function mySet(x,y)
set(x,'ButtonDownFcn',test(y))
children = get(x,'Children');
if ~isempty(children)
for ii = 1:length(children)
mySet(children(ii),y);
end
end
end
function y = test(a)
y = @b;
function b(e,f)
figure
copyobj(a,gcf)
set(gca,'OuterPosition',[0 0 1 1])
end
end