MATLAB: Save jpg Files Under Plot Title Name

.jpgfolderplot

I have a collection of simple plots with the titles displaying:
Indiana
Montana
Texas
Arizona
I need to take these plots and save the plots as jpg files by their TITLE name in a folder named States:
Folder:States
Indiana.jpg
Montana.jpg
Texas.jpg
Arizona.jpg
Thanks,
Amanda

Best Answer

doc saveas %or print
doc get
doc sprintf
Gte the string from the title of the axes:
For example:
figure;axes;plot(magic(20));title('Happy Thursday');
saveas(gcf,sprintf('%s.jpg',get(get(gca,'title'),'string')))