MATLAB: How can I make a fontsize change on a figure and its children as well

fontsize

I have a figure with more than 2 axis and it could have many children in it. How can I change the font size for all parts of the figure? my code is so far:( it doesn't change one of the axis)
set(gcf,'paperunits','centimeters');
set(gcf,'paperposition',[2 2 a(1) a(1)*(1/a(2))]);
textobj=findobj('type','text');
set(textobj,'fontunits','points');
set(textobj,'fontsize',5);
set(findall(gcf,'property','fontsize'),'fontsize',5);
set(gca,'fontsize',5);
set(findall(gca,'type','text'),'fontsize',5);
set(findall(gcf,'type','text'),'fontsize',5);
new_name=strrep([pathName name],'.fig','.png');
child=get(gcf,'children');
for y=1:length(child)
chi=child(y);
set(gcf,'chi','fontsize',11);
end

Best Answer

for y = 1:length(child)
chi=child(y);
set(chi, 'fontsize', 11); % Not set(gcf,'chi','fontsize',11)
end
When you get an error message, posting this in the forum will help to assist you.