I've written a code that saves figures within a loop. Currently I have the code
for k = 1:13 % there is some code here to loop through some files
Y = {'Intensity T=10','Intensity T=15','Intensity T=20','Intensity T=25','Intensity T=30','Intensity T=35','Intensity T=40','Intensity T=45','Intensity T=50','Intensity T=55','Intensity T=60','Intensity T=65','Intensity T=70'}; fig1 = figure('name',Y{k},'numbertitle','off'); for ij = 1:6 x = 0:0.2:9.6; plot(x,fliplr(totalinmodesarray),'k.--'); y = fliplr(intensitymatrix(ij,2:2:end)); intensities{ij} = y; plot(x,y,'.--') xlabel('Current (mA)') ylabel('Power (mW)') hold on end legend('Total','mode 1', 'mode 2', 'mode 3', 'mode 4', 'mode 5', 'mode 6','Location','best') % some saveas command here
end
This works correctly so that each file is called the corresponding value given in Y{k}. However, I want to be able to save each of the files as its name, after the first loop (where I have commented in the code). How can I get the files to save with this name?
Best Answer