Insert a string in a code to export a figure

Hi,
This is code:
...
name='location';
options.Format = 'tiff';
hgexport(gcf, 'name.tif', options);
....
Can the 'location' be inserted to " name.tif" (replace 'name' by 'location')?
The exported filename is 'location.tif' (NOT 'name.tif').

 採用された回答

Guillaume
Guillaume 2015 年 10 月 20 日

0 投票

Use sprintf or plain string concatenation to build your string:
hgexport(gcf, sprintf('%s.tif', name), options);
%or
hgexport(gcf, [name, '.tif'], options);

その他の回答 (0 件)

カテゴリ

質問済み:

ly
2015 年 10 月 20 日

回答済み:

2015 年 10 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by