export_fig: Error when setting relative path

4 vues (au cours des 30 derniers jours)
Peter Bu
Peter Bu le 8 Oct 2017
Commenté : Peter Bu le 8 Oct 2017
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;

Réponse acceptée

Walter Roberson
Walter Roberson le 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
  1 commentaire
Peter Bu
Peter Bu le 8 Oct 2017
Oh. Silly mistake. Thanks alot.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Performance dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by