[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Using a string variable as a filename
From: |
William Krekeler |
Subject: |
RE: Using a string variable as a filename |
Date: |
Mon, 7 Nov 2011 15:54:35 +0000 |
To print a figure to a specific filename. You can replace gcf with a figure
handle. Also I default to saving to png so you would need to change the flag
and filename end.
figure, plot( 1:10 );
outputPath = pwd;
counter_in_loop = 1; % just added to put something in the sprintf to show
that filenames can be built from variable content
print( gcf, '-dpng', fullfile( outputPath, ...
sprintf('some_file_name_%d.png', counter_in_loop) ) );
William Krekeler