MATLAB: Filename of function print

diagramsepsfilefilenameprintvariable

Hello Guys,
I am using the print function for creating eps files for my bachelor thesis.
print('filename' ,'-painters','-depsc', '-r300')
I have the following problem. The filenames of my diagrams are different depending on the experiment. I found out how to use the string function to create names for my diagrams by my inputs. And I am trying the same here.
For example:
name = string({'growthcurve'});
Now Matlab use name for the generation of the diagram title 'growthcurve'.
Is it possible to say the print function also that it should use the variable 'name' to name the file 'growthcurve'. Like print(name ,'-painters','-depsc', '-r300') and the filename then is growthcurve.eps?
Sorry for my english 🙂
Best wishes
Dennis

Best Answer

medium = 'XYZ';
replica = 'Replica1';
nameCurve = ['growthcurve', medium, ' ', replica];
nameSemlog = ['semilogy growthcurve', medium, ' ', replica];
print(nameCurve, '-painters', '-depsc', '-r300')