MATLAB How to Add Titles to Figures in Matlab Loops (M = 0.85:1:2.85)

  • Thread starter Thread starter ADunn
  • Start date Start date
  • Tags Tags
    Figure Matlab
AI Thread Summary
In a MATLAB discussion, a user sought assistance with adding dynamic titles to figures generated within a for loop, specifically for values of M ranging from 0.85 to 2.85. The solution involved using the title function with the correct syntax: title(['M = ', num2str(M)]). The user initially included an extra quote mark, which was corrected in the response. This straightforward approach allows for the display of varying titles corresponding to each plot in the loop.
ADunn
Messages
6
Reaction score
0
In Matlab I have a for loop that plots a figure in each loop. (M = 0.85:1:2.85)
I would like to put a title on the figure "M = 0.85" for the first plot, "M=1.85" for the second plot, and "M=2.85" for the third plot. Can anyone tell me how to do this?

Thank you!
 
Physics news on Phys.org
title(['M = ',num2str(M)'])
 
Sorry, got an extra quote mark in there.
title(['M = ',num2str(M)])
 
Thank you so much!
 

Similar threads

Replies
8
Views
2K
Replies
1
Views
2K
Replies
5
Views
2K
Replies
1
Views
2K
Replies
32
Views
4K
Replies
4
Views
2K
Replies
3
Views
3K
Back
Top