How do I save a figure with the same file name as its title within a for loop?
    조회 수: 2 (최근 30일)
  
       이전 댓글 표시
    
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?
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

