MATLAB: Title for a figure containing many pictures

title for a figure containing many pictures

I am making a figure containing many pictures. I did that by using the subplot function.
I would like to add a title for the whole pictures. How could I do that?
Thanks in advance for your help.

Best Answer

Use sgtitle() function to create a title for a figure containing subplots.
The following code creates 4 subplots with its respective titles and a title for the whole figure.
subplot(2,2,1)
title('First Subplot') % Titles for the respective subplots
subplot(2,2,2)
title('Second Subplot')
subplot(2,2,3)
title('Third Subplot')
subplot(2,2,4)
title('Fourth Subplot')
sgtitle('Subplot Grid Title') % The title for the whole figure
For more information regarding sgtitle function refer to the following link:
Hope this helps in solving your problem.