MATLAB: How to change thickness and font of all axes in a subplot

allaxeschangefontlineMATLABpropertiessize;subplotwidth

I'm plotting a step response of a single input , multi output system using step command. The result is a n*1 subplot. How do I change the font or line thickness of all the subplots together. When I use the following command:
set(gca,'FontName','Arial','FontSize',12,'FontWeight','Bold',  'LineWidth', 2);
it only change the last subplot.

Best Answer

The reason for the behavior that only the last axes is modified is because in your command, you are using 'gca' to set the properties. Using 'gca' gets hold of only the current axes, which in this case would be the last axes that was plotted on the figure.
In order to workaround the issue, you would need to get all the axes handles in the figure. To achieve this, you may use'findobj' function as findobj(gcf,'type','axes'). Please refer to the following code snippet:
subplot(211); plot(1:10);
subplot(212); plot(randi(10,1,10));
set(findobj(gcf,'type','axes'),'FontName','Arial','FontSize',12,'FontWeight','Bold', 'LineWidth', 2);