how to name a figure using a variable name

조회 수: 54(최근 30일)
Johannes Deelstra
Johannes Deelstra 2016년 5월 14일
댓글: Image Analyst 2016년 5월 23일
I have a figure and want to save this as a tiff or jpeg I have changed a date into variable = 'van190392 15' which I want to use in the file name Such that I get as filename;van190392 15.tiff or van190392 15.jpeg I get an error message, it seems not being allowed/possible
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2016년 5월 14일
What is not working?

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
the cyclist 2016년 5월 15일
편집: the cyclist 2016년 5월 15일
variable = 'van190392 15';
figure
plot(rand(3,4))
filename = [variable,'.tif'];
print('-dtiff',filename)
  댓글 수: 2
Image Analyst
Image Analyst 2016년 5월 23일
A related note: To get a figure to have a name you want, instead of like "Figure 1", "Figure 2", etc., you can turn the 'NumberTitle' property 'Off' and set the 'name' property of the figure to a literal string or a string variable:
% Give a name to the title bar/figure.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')

댓글을 달려면 로그인하십시오.

추가 답변(0개)

범주

Find more on Graphics Object Identification in Help Center and File Exchange

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by