MATLAB: How to use “fullfile” with exportgrahics

exportgraphics

One can use fullfile for saveas
saveas(gcf, fullfile(directory, fileName),'jpeg')
But when I try to use
exportgraphics(gcf, fullfile(directory, fileName)', 'eps', 'Resolution',3000)
Then I get an error message
Input must be a row vector of characters or string scalar
What is the next step?

Best Answer

exportgraphics(gcf, fullfile(directory, fileName)', 'eps', 'Resolution',3000)
%^ remove it
Why did you put transpose operator? Also, the output of exportgraphics() depends on extension of filename. It didn't accept file type seperately. So the correct syntax is
fileName = 'filename.eps'
exportgraphics(gcf, fullfile(directory, fileName), 'Resolution', 3000)
Note that it is better to export the eps file as vector.
fileName = 'filename.eps'
exportgraphics(gcf, fullfile(directory, fileName), 'ContentType', 'vector')