Filter löschen
Filter löschen

Insert a string in a code to export a figure

2 Ansichten (letzte 30 Tage)
ly
ly am 20 Okt. 2015
Beantwortet: Guillaume am 20 Okt. 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').

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Printing and Saving finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by