export_fig: Error when setting relative path
3 views (last 30 days)
Show older comments
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;
0 Comments
Accepted Answer
Walter Roberson
on 8 Oct 2017
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
More Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!