Insert a string in a code to export a figure

1 visualización (últimos 30 días)
ly
ly el 20 de Oct. de 2015
Respondida: Guillaume el 20 de Oct. de 2015
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').

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Printing and Saving en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by