export fig error EPS document

5 Ansichten (letzte 30 Tage)
economics student
economics student am 4 Feb. 2021
Beantwortet: Walter Roberson am 10 Feb. 2021
I attach a document created by Matlab to see what could be the matter with Export_fig. The 2014 version and ghostscript have been correctly installed and the graph folder was also in the path. The expected input arguments are correct as far as i am concerned and graphics/data GK folder does exist, is in the path, I have administrator rights and is not open in other applications. Please, what can be the issue?
_export_fig error. Please ensure:
  • that the function you used (C:\Program Files\MATLAB\R2017b\VAR\VAR-Toolbox-main\v3dot0\ExportFig\export_fig.m) version 3.13 is from the expected location
  • and that you did not made a mistake in export_fig's expected input arguments
  • and that ghostscript is properly installed in C:\Program Files\MATLAB\R2017b\VAR\VAR-Toolbox-main\v3dot0\gs9.53.3\bin\gswin32c.exe
If the problem persists, then please report a new issue.
In your report, please upload the problematic EPS file: C:\Users\HP\AppData\Local\Temp\tpfc8d6fbd_3cbc_4eb8_a0a9_88de882788c1.eps (you can then delete this file).
Error using export_fig (line 923)
Could not create graphics/DATA_GK.pdf - perhaps the folder does not exist, or you do not have write permissions, or
the file is open in another application
Error in SaveFigure (line 31)
export_fig(path,['-' type],'-painters')
Error in VARToolbox_Primer (line 60)
SaveFigure('graphics/DATA_GK',1)_

Akzeptierte Antwort

Jan
Jan am 4 Feb. 2021
Bearbeitet: Jan am 4 Feb. 2021
Is "perhaps the folder does not exist" a simple explanation for your problem? Do you expect "graphics/DATA_GK" to be existing? Can you use a full path instead of the relative one?
"the graph folder was also in the path" - what does this mean? Do not insert data folder in Matlab's path but prefer to use absolute path names.
Working with admin privileges is a source of errors. Do not do this on a productive machine.
Are you sure you want to work with the "2014 version" of export_fig in Matlab 2017b? Why not using a current version of this tool?
  5 Kommentare
economics student
economics student am 9 Feb. 2021
Hi, my apologies for the delay.
Have done as advised:
% Replace
% SaveFigure('graphics/DATA_GK', 1)
% by
SaveFigure('C:\...-main\v3dot0\Primer\VarToolbox_Primer\graphics\DATA_GK', 1)
and withdrew the files were data and graphics were loaded (Var Toolbox_Primer) from the path though when runnung the programme the following notification pops up:
"File C:\ ...-main\v3dot0\Primer\VarToolbox_Primer.m is not found in the current folder or on the Matlab path.
To run this file, you can either change the MATLAB current folder or add its folder to the Matlab path.
Change folder / Add Path / Cancel / Help"
How can I change the folder since adding it in the path is not a good idea?
Jan
Jan am 10 Feb. 2021
There is no reason to change the current folder or to add a folder to Matlab's PATH, if you use absolute names of folder and files. But this is working for the data files only. M-Files are searched in the folders contained in Matlab's PATH only.
A genereal programming rule is:
Keep code, data and GUI separated.
This means, that e.g. parameters are defined in an extra function, MAT file or at least in one block on top of a code. Data to be processed are stored in specific folders and the M-files are saved in their own folders. Create the code for processing at first, such that it can be called from a GUI or from other functions. Then the GUI is independent and can be adjusted without caring about the code for processing. Do not use cd() to change the current folder, but absolute filenames.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 10 Feb. 2021
Could not create graphics/DATA_GK.pdf - perhaps the folder does not exist, or you do not have write permissions, or
You are passing in graphics/DATA_GK as the place to save to, and export_fig is automatically appending .pdf as the file extension, and trying to create a file named graphics/DATA_GK.pdf .
However, you made a directory named graphics/DATA_GK that you are expecting the file to be saved into. This is a problem on Windows, which is Not Fond of having a directory and a file with the same base name. Directories do have a real extension for 8.3 naming purposes, but higher level APIs tend to only look at the base name to determine whether a name corresponds to a directory.

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by