Azzera filtri
Azzera filtri

Insert a string in a code to export a figure

2 visualizzazioni (ultimi 30 giorni)
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').

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Printing and Saving in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by