If your plot command is in a loop and you want to change the title everytime based on a changing variable then use the string command and the + operator.
For example,
In my code, the variable "init_level" was changing in each iteration and I wanted it to be in the title of the plots. So I modified the title() command for my figure in the following way.
title('5. For initial Level = '+string(init_level)+' the variation is :' ,'fontsize',3);
Note how the single quotes are used as the string command divides the title into two parts. and the + operator joins them all together.
Here, you can also see how I was able to vary the font size of the title as well.
Source of adding variable value in title - http://www.equalis.com/forums/Posts.aspx?topic=185466
Peace.
For example,
In my code, the variable "init_level" was changing in each iteration and I wanted it to be in the title of the plots. So I modified the title() command for my figure in the following way.
title('5. For initial Level = '+string(init_level)+' the variation is :' ,'fontsize',3);
Note how the single quotes are used as the string command divides the title into two parts. and the + operator joins them all together.
Here, you can also see how I was able to vary the font size of the title as well.
Source of adding variable value in title - http://www.equalis.com/forums/Posts.aspx?topic=185466
Peace.
Great help!
ReplyDeleteThank you