export_fig: Error when setting relative path

2 次查看(过去 30 天)
Hi everyone!
When setting the relative path - in the export_fig function - an error occurs. Does anyone know what the problem might be? The folder 'Plots_Fig' already exists.
% export_fig /Plots_Fig/test.png -opengl -m8;
This version of the code just works fine:
% export_fig test.png -opengl -m8;
And this is the error message:
Error using imwrite (line 467)
Unable to open file "/Plots_Fig/test.png" for writing. You might not have write permission.
Error in export_fig (line 552)
imwrite(A, [options.name '.png'], 'ResolutionUnit', 'meter', 'XResolution', res,
'YResolution', res);
Error in DataPlotter (line 129)
export_fig /Plots_Fig/test.png -opengl -m8;

采纳的回答

Walter Roberson
Walter Roberson 2017-10-8
export_fig /Plots_Fig/test.png -opengl -m8
does not use any relative paths. In Unix systems, a single leading / on a path name always refers to the root of the file system. If you want a relative path, either use ./ or leave off the leading / . So either
export_fig ./Plots_Fig/test.png -opengl -m8
or
export_fig Plots_Fig/test.png -opengl -m8

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by